{"id":190,"date":"2020-07-04T11:15:20","date_gmt":"2020-07-04T11:15:20","guid":{"rendered":"\/?p=190"},"modified":"2020-07-11T03:38:59","modified_gmt":"2020-07-11T03:38:59","slug":"hseb-2062","status":"publish","type":"post","link":"http:\/\/suryaprakash.com.np\/?p=190","title":{"rendered":"HSEB-2062"},"content":{"rendered":"<p>\/\/2062<br \/>\n\/\/Q1.a. write a c prgram to print the 10 positive integers and their factorials.<br \/>\n<span style=\"color: #000080;\">#include&lt;stdio.h&gt;<\/span><br \/>\n<span style=\"color: #000080;\">#define max 10<\/span><br \/>\n<span style=\"color: #000080;\">void main()<\/span><br \/>\n<span style=\"color: #000080;\">{<\/span><br \/>\n<span style=\"color: #000080;\">int i,j,fact,N[max];<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;enter the value of entegers\\n&#8221;);<\/span><br \/>\n<span style=\"color: #000080;\">for(i=1;i&lt;max;i++)<\/span><br \/>\n<span style=\"color: #000080;\">{<\/span><br \/>\n<span style=\"color: #000080;\">scanf(&#8220;%d&#8221;,&amp;N[i]);<\/span><\/p>\n<p><span style=\"color: #000080;\">}<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;Number\\t Factorial\\n&#8221;);<\/span><br \/>\n<span style=\"color: #000080;\">for(i=1;i&lt;max;i++)<\/span><br \/>\n<span style=\"color: #000080;\">{<\/span><br \/>\n<span style=\"color: #000080;\">fact=1;<\/span><br \/>\n<span style=\"color: #000080;\">for(j=1;j&lt;=N[i];j++)<\/span><br \/>\n<span style=\"color: #000080;\">{<\/span><br \/>\n<span style=\"color: #000080;\">fact*=j;<\/span><br \/>\n<span style=\"color: #000080;\">}<\/span><br \/>\n<span style=\"color: #000080;\">\/\/ printf(&#8220;the Number=%d and its Factorial=%d\\n&#8221;,N[i],fact);<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;%d\\t%d\\n&#8221;,N[i],fact);<\/span><\/p>\n<p><span style=\"color: #000080;\">}<\/span><\/p>\n<p><span style=\"color: #000080;\">}<\/span><\/p>\n<p><span style=\"color: #000080;\"><strong>OUTPUT<\/strong><\/span><\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-medium wp-image-191\" src=\"\/wp-content\/uploads\/2020\/07\/hseb2062-300x244.png\" alt=\"\" width=\"300\" height=\"244\" srcset=\"\/wp-content\/uploads\/2020\/07\/hseb2062-300x244.png 300w, \/wp-content\/uploads\/2020\/07\/hseb2062.png 484w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"color: #000080;\">I have given the input in random way.<\/span><\/p>\n<p>\/\/1.c.Write a C Program to input &#8216;n&#8217; numbers and find out greatest and smallest number.<\/p>\n<p><span style=\"color: #000080;\">#include&lt;stdio.h&gt;<\/span><br \/>\n<span style=\"color: #000080;\">void main()<\/span><br \/>\n<span style=\"color: #000080;\">{<\/span><br \/>\n<span style=\"color: #000080;\">int i,j,n, a[20],temp;<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;enter the size of array\\n&#8221;);<\/span><br \/>\n<span style=\"color: #000080;\">scanf(&#8220;%d&#8221;,&amp;n);<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;ente the numbers:-\\n&#8221;);<\/span><br \/>\n<span style=\"color: #000080;\">for(i=0;i&lt;n;i++)<\/span><br \/>\n<span style=\"color: #000080;\">scanf(&#8220;%d&#8221;,&amp;a[i]); \/\/taking input values<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;the input values are:&#8221;);<\/span><br \/>\n<span style=\"color: #000080;\">for(i=0;i&lt;n;i++)<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;\\t%d&#8221;,a[i]);\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #000080;\"><span style=\"color: #000000;\">\u00a0<\/span><\/span><br \/>\n<span style=\"color: #000080;\">for(i=0;i&lt;n-1;i++)<\/span><br \/>\n<span style=\"color: #000080;\">{<\/span><\/p>\n<p><span style=\"color: #000080;\">for(j=i+1;j&lt;n;j++)<\/span><br \/>\n<span style=\"color: #000080;\">{<\/span><br \/>\n<span style=\"color: #000080;\">if(a[i]&gt;a[j])<\/span><br \/>\n<span style=\"color: #000080;\">{ \/\/the main logic part <\/span><br \/>\n<span style=\"color: #000080;\">temp=a[i];<\/span><br \/>\n<span style=\"color: #000080;\">a[i]=a[j];<\/span><br \/>\n<span style=\"color: #000080;\">a[j]=temp;<\/span><br \/>\n<span style=\"color: #000080;\">}<\/span><br \/>\n<span style=\"color: #000080;\">}<\/span><br \/>\n<span style=\"color: #000080;\">}<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;\\nthe element in ascending order is:\\n&#8221;); <\/span><br \/>\n<span style=\"color: #000080;\">for(i=0;i&lt;n;i++)<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;\\t%d&#8221;,a[i]);<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;\\nthe highest number is %d&#8221;,a[n-1]);<\/span><br \/>\n<span style=\"color: #000080;\">printf(&#8220;\\nthe lowest number is %d&#8221;,a[0]);<\/span><br \/>\n<span style=\"color: #000080;\">}<\/span><\/p>\n<p><strong>OUTPUT<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-medium wp-image-194\" src=\"\/wp-content\/uploads\/2020\/07\/2062-c-300x183.png\" alt=\"\" width=\"300\" height=\"183\" srcset=\"\/wp-content\/uploads\/2020\/07\/2062-c-300x183.png 300w, \/wp-content\/uploads\/2020\/07\/2062-c.png 610w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"color: #000080;\">In the given program first i have changed the array value\u00a0 in ascending order and then automatically the the first value of the array the array will be smallest and the last will be highest value.<\/span><\/p>\n<p>Note:- Displaying the numbers in ascending order is extra work in my program code. There is no need of that portion.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/2062 \/\/Q1.a. write a c prgram to print the 10 positive integers and their factorials. #include&lt;stdio.h&gt; #define max 10 void &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,8],"tags":[],"_links":{"self":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts\/190"}],"collection":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=190"}],"version-history":[{"count":5,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts\/190\/revisions"}],"predecessor-version":[{"id":198,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts\/190\/revisions\/198"}],"wp:attachment":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}