<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-8377073689381508822</atom:id><lastBuildDate>Fri, 25 Oct 2024 05:17:23 +0000</lastBuildDate><category>Basic Programs</category><category>Looping Programs</category><category>Conditional Programs</category><category>Pointer Programs</category><title>C Programs Basics</title><description> Learn 2 Code Be A Programmer</description><link>http://cprogramsbasics.blogspot.com/</link><managingEditor>noreply@blogger.com (Bhushan hadkar)</managingEditor><generator>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-3074242199068799945</guid><pubDate>Mon, 29 Dec 2014 06:59:00 +0000</pubDate><atom:updated>2015-07-21T19:36:00.592+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basic Programs</category><title>C Program Fahrenheit To Celsius Conversion And Vice Versa</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3YT2jV8E37Q-Pi6r-1rv4BSf_w0Qvv9RMCdgMXJRYO-p_GnZrGPcIefddGNO1F0w5SSs7RiGRV_-PnZp31KGYce_htp3_x98CPcJerdaJxrZVJz4SHGBPJm1AFoiVA4HlAj96_R5mjpw/s1600/c-program-convert-fahrenheit-to-celsius.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
We going to perform&amp;nbsp;the c program&amp;nbsp;of temperature conversion&amp;nbsp;from Fahrenheit to Celsius and vice versa.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;We can use the following formulas to do so :&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
C =&amp;nbsp;(f-32)/1.8.&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&amp;nbsp;f = 1.8 * C&amp;nbsp;+ 32.&lt;/div&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program To Convert Temperature From Fahrenheit To Celsius&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;

void main()
{
 float celsius, fahrenheit;
 clrscr();

 printf(&quot;\n Enter Temp in Fahrenheit : &quot;);
 scanf(&quot;%f&quot;, &amp;amp;fahrenheit);

 &lt;b&gt;celsius = (fahrenheit-32) / 1.8;&lt;/b&gt;
 printf(&quot;\n Temperature in Celsius : %.2f &quot;, celsius);

 getch();

}&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;Output :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiviqWue9XR86-gwKVyxj34VRKqDOGANorX2DLe5cUvSR_DvmlMKQjFDncJ2wRuBcXl1B87Yxyd2n_57gGrg6EoSOWoC-sL7brwFoF-aWxkqJBeOiNV_TMqAVkWur-dbXiQYPrEQjpT09Y/s1600/c-program-convert-fahrenheit-to-celsius.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Temperature-Conversion-Fahrenheit-to-Celsius&quot; border=&quot;0&quot; height=&quot;153&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiviqWue9XR86-gwKVyxj34VRKqDOGANorX2DLe5cUvSR_DvmlMKQjFDncJ2wRuBcXl1B87Yxyd2n_57gGrg6EoSOWoC-sL7brwFoF-aWxkqJBeOiNV_TMqAVkWur-dbXiQYPrEQjpT09Y/s400/c-program-convert-fahrenheit-to-celsius.PNG&quot; title=&quot;Output-Temperature-Conversion-Fahrenheit-to-Celsius&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt; &lt;span style=&quot;font-weight: normal;&quot;&gt;Temperature Conversion From Celsius to Fahrenheit C Program&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;

void main()
{
 float celsius, fahrenheit;
 clrscr();

 printf(&quot;\n Enter Temp in Celsius : &quot;);
 scanf(&quot;%f&quot;, &amp;amp;celsius);

 &lt;b&gt;fahrenheit = (1.8 * celsius) + 32;&lt;/b&gt;
 printf(&quot;\n Temperature in Fahrenheit : %.2f &quot;, fahrenheit);

 getch();

}&lt;/pre&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;Output :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyIomCnFGq0_fhw5yfAy1jB7qTFyuODFHVRoi5V8VaZYyOQomNnooiXAUlU_ACLIpOaYsBdRIeL6eKMsc1eg2act_zlET9pVzX7gebuTiXcaro_k1c_cChJnHqszdIbkKiGA1iJI8PGaw/s1600/c-program-convert-celsius-to-fahrenheit.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Temperature-Conversion-Celsius-to-Fahrenheit&quot; border=&quot;0&quot; height=&quot;133&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyIomCnFGq0_fhw5yfAy1jB7qTFyuODFHVRoi5V8VaZYyOQomNnooiXAUlU_ACLIpOaYsBdRIeL6eKMsc1eg2act_zlET9pVzX7gebuTiXcaro_k1c_cChJnHqszdIbkKiGA1iJI8PGaw/s400/c-program-convert-celsius-to-fahrenheit.PNG&quot; title=&quot;Output-Temperature-Conversion-Celsius-to-Fahrenheit&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
In this way we can easily convert&amp;nbsp;temperature from fahrenheit to celsius and vice versa.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/temperature-from-fahrenheit-to-celsius-vice-versa.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3YT2jV8E37Q-Pi6r-1rv4BSf_w0Qvv9RMCdgMXJRYO-p_GnZrGPcIefddGNO1F0w5SSs7RiGRV_-PnZp31KGYce_htp3_x98CPcJerdaJxrZVJz4SHGBPJm1AFoiVA4HlAj96_R5mjpw/s72-c/c-program-convert-fahrenheit-to-celsius.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-3850904773391331332</guid><pubDate>Sat, 20 Dec 2014 11:37:00 +0000</pubDate><atom:updated>2015-08-17T20:45:23.985+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Looping Programs</category><title>C Program To Find Armstrong Number Using Do While Loop</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpmVexBOmO86KbbTPnZ4CKWPoqABZMoHT3jdb_YT79156eMJQvSYSrBg8KkPjp2tfhQ-yLe_gak2JtlHN39SlfN0LdmCX-sgqYiTIpbjqGYcFIE8ZrBXaEdPdGzP5BkHkVEpueI1-buzY/s1600/c-program-to-check-armstrong-number.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
In this C program, we are going to find whether an entered number by user is an Armstrong number or Not.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
What is an Armstrong Number ?&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;An&amp;nbsp;&lt;strong&gt;Armstrong number&lt;/strong&gt;&amp;nbsp;of three digits is an integer such that the sum of the cubes of its digits is equal to the&amp;nbsp;number&amp;nbsp;itself.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
For example, 153 is an&amp;nbsp;&lt;strong&gt;Armstrong number&lt;/strong&gt;&amp;nbsp;since 1*1*1 + 5*5*5+ 3*3*3= 153.&amp;nbsp;&lt;/div&gt;
&lt;h2 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;
C Program To Find Armstrong Number&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n,c,d,s=0,num;
 clrscr();

 printf(&quot;\n Enter Any Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 num=n;

 do
 {
  d=n%10;
  c=d*d*d;
  s=s+c;
  n=n/10;
 }while(n!=0);

 if(s==num)
   printf(&quot;\n %d is Armstrong Number&quot;,num);

 else
   printf(&quot;\n %d is Not an Armstrong Number&quot;,num);

 getch();

}&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;strong&gt;Output :&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgovawn7vSPmR7OaSpGmrLM7iptZ2m8uDmQ-KimeExnku_Gi9bItgQ_5T4JzOwIBzQVLb-v3jiY52k13g9TDpG1afE_VjeV9nfl0SMW1MTc8WulqFI9rU_AK2I2sYb601UL0NQuH6JAX077/s1600/armstrong_number.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;armstrong-number-c-program&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgovawn7vSPmR7OaSpGmrLM7iptZ2m8uDmQ-KimeExnku_Gi9bItgQ_5T4JzOwIBzQVLb-v3jiY52k13g9TDpG1afE_VjeV9nfl0SMW1MTc8WulqFI9rU_AK2I2sYb601UL0NQuH6JAX077/s1600/armstrong_number.jpg&quot; title=&quot;armstrong-number-c-program&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2ZHZ16CixR8232PgT_32E3cxp5KJlPatSlZI2GRMBhT7M61008UpyPl5pSwrLESBuhvlXAT_P6M3rM51YugR_ObDOAiMPUnAVp3edcT7g-Cdk-uTA3hB41bDcrfwvGWbcI2OnAh-viwHK/s1600/not_armstrong_number.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;not-an-armstrong-number&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2ZHZ16CixR8232PgT_32E3cxp5KJlPatSlZI2GRMBhT7M61008UpyPl5pSwrLESBuhvlXAT_P6M3rM51YugR_ObDOAiMPUnAVp3edcT7g-Cdk-uTA3hB41bDcrfwvGWbcI2OnAh-viwHK/s1600/not_armstrong_number.jpg&quot; title=&quot;not-an-armstrong-number&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In this way we can check armstrong number in c. Also check, how we can &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/find-armstrong-number-in-given-range.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;find armstrong numbers in a given range&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/find-armstrong-number-using-do-while.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpmVexBOmO86KbbTPnZ4CKWPoqABZMoHT3jdb_YT79156eMJQvSYSrBg8KkPjp2tfhQ-yLe_gak2JtlHN39SlfN0LdmCX-sgqYiTIpbjqGYcFIE8ZrBXaEdPdGzP5BkHkVEpueI1-buzY/s72-c/c-program-to-check-armstrong-number.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-7109831344061569643</guid><pubDate>Sat, 20 Dec 2014 11:17:00 +0000</pubDate><atom:updated>2015-08-17T20:45:56.052+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Looping Programs</category><title>C Program To Find Armstrong Number In Given Range (0-999)</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglkX-seas-8_foAPpOpAt0LqK0_qyjZgtiZF63dTxe9aj-zjB6xxIyDRXKHcIlXD_d37MKUe7jzRUYMTNukn7sTuoX4a8OAWFRxsIxwhCDTWVug91EOCEFB89V8toFZ3oQfBrPuPTpxgU/s1600/c-program-to-find-armstrong-numbers-in-given-range.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;We have seen how to check if the given number is&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/find-armstrong-number-using-do-while.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;Armstrong number&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; or not in&amp;nbsp;c, now we have to find armstrong numbers in a&amp;nbsp;range of numbers&amp;nbsp;specified by the user.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;To perform this program we have to get a number from the user, and run a loop from 1 to the number entered by the user.&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;And In this loop, we have to run the program to check the given number&amp;nbsp;is armstrong number or not. And then if the number armstrong we have to print it on the screen.&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program To Generate And Print Armstrong Numbers&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n,i,t,c,d,s=0;
 clrscr();

 printf(&quot;\n Enter the range from 0 to : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 printf(&quot;\n Armstrong Numbers are :&quot;);

 for(i=0;i&amp;lt;=n;i++)
  {
    t=i;
    s=0;

 while(t!=0)
  {
    d=t%10;
    c=d*d*d;
    s=s+c;
    t=t/10;
  }

 if(s==i)
    printf(&quot; %d&quot;,i);

 }

 getch();

}&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Output :&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEith88J2LlbMYmgpcIxgHFvsqH-Ky_8s4MRmVPmgODlPlXFvJS0vVrPF8_URRp7VD2QmIPsjQuNCCZmSVY9sROWS_CfJ6EhUVxYdzMY5sLpbBYmwR2Sg3L_ixPwpIeeZY3j7ZuiGFbXN19v/s1600/armstrong_number_on_given_range.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;armstrong-number-on-given-range&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEith88J2LlbMYmgpcIxgHFvsqH-Ky_8s4MRmVPmgODlPlXFvJS0vVrPF8_URRp7VD2QmIPsjQuNCCZmSVY9sROWS_CfJ6EhUVxYdzMY5sLpbBYmwR2Sg3L_ixPwpIeeZY3j7ZuiGFbXN19v/s1600/armstrong_number_on_given_range.jpg&quot; title=&quot;armstrong-number-on-given-range&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;In this way we can print armstrong numbers in a given range.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/find-armstrong-number-in-given-range.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglkX-seas-8_foAPpOpAt0LqK0_qyjZgtiZF63dTxe9aj-zjB6xxIyDRXKHcIlXD_d37MKUe7jzRUYMTNukn7sTuoX4a8OAWFRxsIxwhCDTWVug91EOCEFB89V8toFZ3oQfBrPuPTpxgU/s72-c/c-program-to-find-armstrong-numbers-in-given-range.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-3616042341315159556</guid><pubDate>Wed, 10 Dec 2014 16:50:00 +0000</pubDate><atom:updated>2015-07-21T21:06:32.757+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Looping Programs</category><title>C Program To Find The Given Number Is Prime Or Not</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5OfMuZSedo31DUeM-bImkZumdGKK_G-8L-Ovj9hyphenhyphenFw2SzoGRzeaHqugm8Ic-KfpFvUxADLxUBqLeQs3UeUh4JDeB_UgUQ4ihGmyHdPvCY3bFCGC_uyCmzXxNDfK_vOL30uc1WnLn5s5E/s1600/c-program-to-find-the-given-number-is-prime-or-not.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;In the following program, we are going to find if the number entered by the user is a prime number or not. We can use different methods to do so.&lt;/span&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;What is a prime number?&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;A &lt;/span&gt;&lt;a href=&quot;http://www.mathsisfun.com/definitions/prime-number.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;Prime Number&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; is the one which can be evenly divided only by 1 and Itself.&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;C Program To Find Prime Number or Not&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{

 int n,i;
 clrscr();

 printf(&quot;\n Enter Any Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 for(i=2;&lt;b&gt;i&amp;lt;=n-1&lt;/b&gt;;i++)
   {
     if(n%i==0)
     {
       break;
     }
   }

 if(n==i)
    printf(&quot;\n Prime Number&quot;);

 else
    printf(&quot;\n Not Prime Number&quot;);


  getch();

 }&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Output :&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRiFyn-xgQucmuQd0pM85PTRiR02sChz13H6NJKDUln-abmgXkTSKnU5W6G0VW0SvpCVBgJutq3m_HsvSZRewCs7UGh0DCcmqlXqzbeWvedN97Ph9ltED7ixMKiG42d1tXbhs2pz6-xLWk/s1600/not_prime_number.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Prime-Number-or-not&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRiFyn-xgQucmuQd0pM85PTRiR02sChz13H6NJKDUln-abmgXkTSKnU5W6G0VW0SvpCVBgJutq3m_HsvSZRewCs7UGh0DCcmqlXqzbeWvedN97Ph9ltED7ixMKiG42d1tXbhs2pz6-xLWk/s1600/not_prime_number.jpg&quot; title=&quot;Output-Prime-Number-or-not&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmVnvfGoo4rR4KA9NlEjZwirEggQuAs5YJ8G6MF3g5xOkIEPT43SvQVteXh7addxMvRplGB0ibxaY1RedRfdNpbppwD0EztbIrmD1jERm4EBnCTPUCDpE7NxnNK6fDqSx_n2a4zVmhGat6/s1600/prime_number.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Given-Number-Is-Prime-Or-Not&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmVnvfGoo4rR4KA9NlEjZwirEggQuAs5YJ8G6MF3g5xOkIEPT43SvQVteXh7addxMvRplGB0ibxaY1RedRfdNpbppwD0EztbIrmD1jERm4EBnCTPUCDpE7NxnNK6fDqSx_n2a4zVmhGat6/s1600/prime_number.jpg&quot; title=&quot;Output-Given-Number-Is-Prime-Or-Not&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
In the above program what we do is,&amp;nbsp;&lt;/div&gt;
&lt;ul style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;
&lt;li style=&quot;margin-bottom: 1em;&quot;&gt;we get a number from the user.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 1em;&quot;&gt;Start a loop which divides the entered number by 2,3,4... and so on until the number one less than the entered number.(since any number is completely divisible by 1 we start the loop from 2)&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 1em;&quot;&gt;Here is the tricky part.&lt;br /&gt;If the entered number isn&#39;t completely divisible by any of the number(which&amp;nbsp;suggest the number is prime), that means the loop will run until the number&amp;nbsp;one less than the entered number and value of &#39;i&#39; will be equal to the entered number in the end. i.e(n==i)&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 1em;&quot;&gt;Otherwise the number will be not prime.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
However, this method is not so efficient when finding any bigger number such as 500 or 1000. As in that case, the loop has to run 499 and 999 times respectively.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-size: 24px;&quot;&gt;
One way mentioned in the video below can be more effective to find the given number is a prime number or not.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;youtube-container&quot;&gt;
&lt;div class=&quot;youtube-player&quot; data-id=&quot;3MYx9PrpXEg&quot;&gt;
&lt;/div&gt;
&lt;style&gt;
.youtube-container { display: block; margin: 20px auto; width: 100%; max-width: 600px; }
.youtube-player { display: block; width: 100%; /* assuming that the video has a 16:9 ratio */ padding-bottom: 56.25%; overflow: hidden; position: relative; width: 100%; height: 100%; cursor: hand; cursor: pointer; display: block; }
img.youtube-thumb { bottom: 0; display: block; left: 0; margin: auto; max-width: 100%; width: 100%; position: absolute; right: 0; top: 0; height: auto }
div.play-button { height: 72px; width: 72px; left: 50%; top: 50%; margin-left: -36px; margin-top: -36px; position: absolute; background: url(&quot;http://i.imgur.com/TxzC70f.png&quot;) no-repeat; }
#youtube-iframe { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
&lt;/style&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d; font-size: 24px;&quot;&gt;Also Check: &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/find-prime-numbers-in-given-range.html&quot; style=&quot;font-size: 24px;&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;C Program to Find Prime Numbers in A Given Range&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3 style=&quot;color: #0d0d0d; margin-bottom: 1.1em; margin-top: 1.1em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;C Program To Find The Prime Number Or Not Using The Function&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;

int prime(int m);

void main()
{

 int n;
 clrscr();

 printf(&quot;\n Enter Any Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 prime(n);

 getch();

 }

 int prime(int m)
 {
  int i,temp;
  for(i=2;&lt;b&gt;i&amp;lt;=m/2&lt;/b&gt;;i++)
   {
     if(m%i==0)
     {
       temp=0;
       break;
     }
     else
      temp=1;
   }

 if(temp)
    printf(&quot;\n Prime Number&quot;);

 else
    printf(&quot;\n Not Prime Number&quot;);

   return 0;
 }

&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; white-space: normal;&quot;&gt;
In this way we, we can find a number is prime or not using this simple method.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/find-given-number-is-prime-or-not.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5OfMuZSedo31DUeM-bImkZumdGKK_G-8L-Ovj9hyphenhyphenFw2SzoGRzeaHqugm8Ic-KfpFvUxADLxUBqLeQs3UeUh4JDeB_UgUQ4ihGmyHdPvCY3bFCGC_uyCmzXxNDfK_vOL30uc1WnLn5s5E/s72-c/c-program-to-find-the-given-number-is-prime-or-not.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-795188868682802432</guid><pubDate>Wed, 10 Dec 2014 16:38:00 +0000</pubDate><atom:updated>2015-07-17T21:30:05.361+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Looping Programs</category><title>C Program To Find Prime Numbers In A Given Range</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglDvbnWmz8Co9v4DfyOm5BQ0uS70XJTsG7K6VjMSYiiEGIU2w5xQOsTS2KfwdlRoilB2Itv7pq_vN58V6xqkiHaZl6-EThy9JWno7HnO_AI77mDxmqCbc-3QR6DOGmoMuGIecWyDCw0k8/s1600/c-program-to-find-prime-numers-in-given-range.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;We have seen how to &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/find-given-number-is-prime-or-not.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;find the given number is prime or not&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; earlier. Now we will calculate prime numbers on a given range and print them on the screen.&lt;/span&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d; font-size: x-large;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Display Prime Numbers On a Given Range&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{

 int n,i,t;
 clrscr();

 printf(&quot;\n Enter The Range From 1 to : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;t);

 printf(&quot;\n Prime Numbers in the Range 1-%d :\n\n &quot;,t);
 for(n=1;n&amp;lt;=t;n++)
  {
    for(i=2;i&amp;lt;=n-1;i++)
      {
        if(n%i==0)
          {
            break;
          }
      }

 if(n==i)
  printf(&quot; %d&quot;,n);

  }
  getch();

}&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Output :&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGnoh1ioPLqb0fjNgdNaHjCHJkQK-KC4sqXGNQ6e2lNBrT_iLUTh6V_UhjQDna19bDtNSOKAiTty44WyBjiHIRt5kGit2P9VyVl74xvUgdIKlyokIjpXnp22I9R99JxHC7K3YeF4AhRuXC/s1600/prime_numbers_range.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Find-Prime-Numbers-In-Given-Range&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGnoh1ioPLqb0fjNgdNaHjCHJkQK-KC4sqXGNQ6e2lNBrT_iLUTh6V_UhjQDna19bDtNSOKAiTty44WyBjiHIRt5kGit2P9VyVl74xvUgdIKlyokIjpXnp22I9R99JxHC7K3YeF4AhRuXC/s1600/prime_numbers_range.jpg&quot; title=&quot;Output-Find-Prime-Numbers-In-Given-Range&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&amp;nbsp;Following are &lt;i&gt;the prime numbers from 1-100.&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmPdPOr_Y4fb7YoYFz7BibRYxLC7N1FreAkiwbda70YSQ7hNdmMz1A_4FSMtp6ig-PctWfCe72Us6wtlckMlwkrmidcJF46fjsa2lMRNU5Q8cuYNepZs-k8bTDatVN2Gfqt9PKcjvleRI/s1600/c-program-the-given-number-is-prime-or-not.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;prime-numbers-on-given-range-1-100&quot; border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmPdPOr_Y4fb7YoYFz7BibRYxLC7N1FreAkiwbda70YSQ7hNdmMz1A_4FSMtp6ig-PctWfCe72Us6wtlckMlwkrmidcJF46fjsa2lMRNU5Q8cuYNepZs-k8bTDatVN2Gfqt9PKcjvleRI/s640/c-program-the-given-number-is-prime-or-not.jpg&quot; title=&quot;prime-numbers-on-given-range-1-100&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;In this way we, we can find prime numbers on given range and display them on the screen.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/find-prime-numbers-in-given-range.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglDvbnWmz8Co9v4DfyOm5BQ0uS70XJTsG7K6VjMSYiiEGIU2w5xQOsTS2KfwdlRoilB2Itv7pq_vN58V6xqkiHaZl6-EThy9JWno7HnO_AI77mDxmqCbc-3QR6DOGmoMuGIecWyDCw0k8/s72-c/c-program-to-find-prime-numers-in-given-range.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-997472038075673630</guid><pubDate>Wed, 10 Dec 2014 15:24:00 +0000</pubDate><atom:updated>2015-07-13T21:04:00.677+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Looping Programs</category><title>C Program To Reverse A Number Using While Loop</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg09PoM99vT48QSAecDUsTJoaH3eaVCycvGsgP0a8W-40035BVVZqfuiHwM_I6svZZFnXGF9kZZIAWKnO60nCpuBTu4e7PEdCm-JFTplFLPwzWY7UIjgYLCP00C2HFO5M6YHE5FDIuo_EU/s1600/c-program-to-reverse-a-number.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
We are going to write a c program to take a number as an input and reverse that number. We can do this by reversing each single digits of the whole number.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: x-large; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;Reverse The Number Using While Loop&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{

 long int a,rev,d;
 clrscr();

 printf(&quot;\n **************************&quot;);

 printf(&quot;\n Enter Any Number: &quot;);
 scanf(&quot;%ld&quot;,&amp;amp;a);

 rev=0;
 while(a!=0)
  {
    d=a%10;
    rev=rev*10+d;
    a=a/10;
  }

 printf(&quot;\n Reverse Number = %ld&quot;,rev);

 printf(&quot;\n **************************&quot;);

 getch();

}&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Output :&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFY9rXBFAuBdC9zSMS82OdpR4fVJNiVFEN1SCrDY8ckIF-oe7At_1hznJMeANmJsYZvWyRO4hrpgRE-Ju-FTCgJXzFLl_1U9K01Q3AskhvJGU29WDPFJ8tiShyphenhyphen0iFTsUQU-MbfLe8tN2yQ/s1600/reverse-the-number.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-C-Program-To-Reverse-Number&quot; border=&quot;0&quot; height=&quot;140&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFY9rXBFAuBdC9zSMS82OdpR4fVJNiVFEN1SCrDY8ckIF-oe7At_1hznJMeANmJsYZvWyRO4hrpgRE-Ju-FTCgJXzFLl_1U9K01Q3AskhvJGU29WDPFJ8tiShyphenhyphen0iFTsUQU-MbfLe8tN2yQ/s400/reverse-the-number.jpg&quot; title=&quot;Output-C-Program-To-Reverse-Number&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
In this way we can &lt;i&gt;reverse a number using while loop&lt;/i&gt; in c programming.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/reverse-number-using-while-loop.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg09PoM99vT48QSAecDUsTJoaH3eaVCycvGsgP0a8W-40035BVVZqfuiHwM_I6svZZFnXGF9kZZIAWKnO60nCpuBTu4e7PEdCm-JFTplFLPwzWY7UIjgYLCP00C2HFO5M6YHE5FDIuo_EU/s72-c/c-program-to-reverse-a-number.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-3140184442613569753</guid><pubDate>Mon, 08 Dec 2014 10:51:00 +0000</pubDate><atom:updated>2015-07-21T21:04:59.576+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Looping Programs</category><title>C Program For Multiplication Table Of Number Using For Loop</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGe2lEHx5qRpI87iaPTd0s3yi3geJ2kJ-w8-7GlO_wXh4Sb1SNMNYpgVoj3ibHoAHV4sE_GLMlBCcTuwCNR5mUfWREtuyr_xbZEnU9wGYwj8RH4B3SEtrkmyNvC3ZPWioxEbYPdHlMki8/s1600/c-program-for-multiplication-table.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;span style=&quot;font-size: 24px;&quot;&gt;We are going to code multiplication table program in c, wherein we get a number from the user and print multiplication table of that number using for loop.&lt;/span&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;C Program To Display Multiplication Table&lt;/span&gt;&lt;/h2&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()

{

int n,i,a=1;
clrscr();

 printf(&quot;\n Enter Any Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 if(n&amp;lt;=0)
 printf(&quot;\n Negative Number Or Zero Not Allowed ! &quot;);

 else

 for(i=1;i&amp;lt;=10; i++)
 {
 &lt;b&gt;a=n*i;&lt;/b&gt;
 printf(&quot;\n  %d&quot;,a);
 }

 getch();
 }&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;Output :&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNJUUq598qkaQ67kxZjUuILcgCX0bf0DbtLIF_6PL_nNtBdjCvjZU8atNrxP0mJg7lEgrutjwuXz4TY5EI3cYtTOdM-nVZF3zxyx0sKKh5PT7S43oVsnoh6d4NMLTHi9JuSnm8xjRJ3rCo/s1600/multiplication_table.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Multiplication-Table-Of-Number-Using-For-Loop&quot; border=&quot;0&quot; height=&quot;282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNJUUq598qkaQ67kxZjUuILcgCX0bf0DbtLIF_6PL_nNtBdjCvjZU8atNrxP0mJg7lEgrutjwuXz4TY5EI3cYtTOdM-nVZF3zxyx0sKKh5PT7S43oVsnoh6d4NMLTHi9JuSnm8xjRJ3rCo/s400/multiplication_table.jpg&quot; title=&quot;Output-Multiplication-Table-Of-Number-Using-For-Loop&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;In the above program, we multiply the number entered by the user with &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-print-natural-numbers.html&quot; style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;1 to 10&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; with the help of a for loop and store the value in &lt;/span&gt;variable&lt;span style=&quot;color: #0d0d0d;&quot;&gt; &#39;a&#39; each time the loop is executed. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Check the programs we can do with the help of &lt;/span&gt;&lt;i&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/search/label/Looping%20Programs&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;Loop In C&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;.&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt; &lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Thus, we get &lt;/span&gt;&lt;a href=&quot;https://www.mathsisfun.com/tables.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;multiplication table&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; of the entered number and we print it using the printf&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;statement&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;in c&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Know, &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/11/first-c-program-hello-world.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;How to display something on the output screen&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; in the first c program.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/multiplication-table-using-for-loop.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGe2lEHx5qRpI87iaPTd0s3yi3geJ2kJ-w8-7GlO_wXh4Sb1SNMNYpgVoj3ibHoAHV4sE_GLMlBCcTuwCNR5mUfWREtuyr_xbZEnU9wGYwj8RH4B3SEtrkmyNvC3ZPWioxEbYPdHlMki8/s72-c/c-program-for-multiplication-table.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-2780348966652704643</guid><pubDate>Mon, 08 Dec 2014 10:35:00 +0000</pubDate><atom:updated>2015-07-19T12:02:32.029+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Looping Programs</category><title>C Program To Find Factorial Of A Number Using While Loop</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDxTOVODNqjOcfnbDitH94SfD4WXcGj-NV39yM2OGgyYEEAUc33vMIftb_AQDWywjaACNWXDtW6hFWZwUxsX_hxl4eR0sLb3Df4iI9jXWREiJd4M-pkuozuobHwydkz52j2ejVUwHmMqI/s1600/c-program-to-find-factorial.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
In this c program, we are going to &lt;i&gt;calculate the factorial&lt;/i&gt; of any entered number using &lt;u&gt;while loop&lt;/u&gt; and &lt;u&gt;for loop&lt;/u&gt;. We can also define a function to do so.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: x-large; letter-spacing: -1px; line-height: 36px;&quot;&gt;Calculate Factorial Of A Number Using While Loop&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int num,i;
 long fact=1;
 clrscr();

 printf(&quot;\n Enter Any Number: &quot;);
 scanf(&quot;%d&quot;,&amp;amp;num);

 if(num&amp;lt;=0)
 printf(&quot;\n Invalid Number! &quot;);

 else
 {
   fact=num;

   &lt;b&gt;i=1;
   while(i&amp;lt;num)
    {
      fact=fact*i;
      i++;
    }&lt;/b&gt;

    printf(&quot;\n Factorial = %ld&quot;,fact);
 }
 getch();

}&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
Output:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmdtYxy0wsZEP4-5kDCf_8JIzOsX4zTWreamHUpGlmBNvpSqm4aFun6WL_lx5spchj0ms9c2JMy7B_dorXX8Y1dd3aCxHQfHTO0D_BtN3Y5IorDf7NmNJRCtIKvongBs2LGStIeGGUe_Vu/s1600/Factorial.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;output-factorial-of-a-number-while-loop&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmdtYxy0wsZEP4-5kDCf_8JIzOsX4zTWreamHUpGlmBNvpSqm4aFun6WL_lx5spchj0ms9c2JMy7B_dorXX8Y1dd3aCxHQfHTO0D_BtN3Y5IorDf7NmNJRCtIKvongBs2LGStIeGGUe_Vu/s1600/Factorial.jpg&quot; title=&quot;output-factorial-of-a-number-while-loop&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: x-large; font-weight: normal; letter-spacing: -1px; line-height: 36px;&quot;&gt;C Program To Find Factorial Of A Number Using For Loop&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int num,i;
 long fact=1;
 clrscr();

 printf(&quot;\n Enter Any Number: &quot;);
 scanf(&quot;%d&quot;,&amp;amp;num);
 if(num&amp;lt;=0)
 printf(&quot;\n Invalid Number ! &quot;);

 else
 {
  fact=num;

  &lt;b&gt;for(i=1;i&amp;lt;num;i++)
    {
     fact=fact*i;
    }&lt;/b&gt;

    printf(&quot;\n Factorial = %ld&quot;,fact);
 }
 getch();

}&lt;/pre&gt;
&lt;div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;br /&gt;
I found the appropriate explanation of the above program in the video below.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;youtube-container&quot;&gt;
&lt;div class=&quot;youtube-player&quot; data-id=&quot;PYLaSrO84nU&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;style&gt;
.youtube-container { display: block; margin: 20px auto; width: 100%; max-width: 600px; }
.youtube-player { display: block; width: 100%; /* assuming that the video has a 16:9 ratio */ padding-bottom: 56.25%; overflow: hidden; position: relative; width: 100%; height: 100%; cursor: hand; cursor: pointer; display: block; }
img.youtube-thumb { bottom: 0; display: block; left: 0; margin: auto; max-width: 100%; width: 100%; position: absolute; right: 0; top: 0; height: auto }
div.play-button { height: 72px; width: 72px; left: 50%; top: 50%; margin-left: -36px; margin-top: -36px; position: absolute; background: url(&quot;http://i.imgur.com/TxzC70f.png&quot;) no-repeat; }
#youtube-iframe { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
&lt;/style&gt;&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: x-large; font-weight: normal; letter-spacing: -1px; line-height: 36px;&quot;&gt;Find Factorial Of A Number Using Function&lt;/span&gt;&lt;/h4&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;

&lt;b&gt;void factorial();&lt;/b&gt;

void main()
{
 clrscr();

 &lt;b&gt;factorial();&lt;/b&gt;

 getch();

}

&lt;b&gt;void factorial()
{
 int i,n;
 long fact=1;

 printf(&quot;\n Enter Any Number: &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 if(n&amp;lt;=0)
 printf(&quot;\n Negative Number or Zero Not Allowed ! &quot;);

 else
 {
  fact=n;

  for(i=1;i&amp;lt;n;i++)
    {
     fact=fact*i;
    }
 }
 printf(&quot;\n Factorial = %ld&quot;,fact);
&lt;/b&gt;
 }&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;div style=&quot;margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In this way, we can find &lt;/span&gt;&lt;a href=&quot;https://www.mathsisfun.com/numbers/factorial.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;factorial&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; of any given number with the help of while loop, for loop as well as function.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/factorial-of-number-while-for-loop.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDxTOVODNqjOcfnbDitH94SfD4WXcGj-NV39yM2OGgyYEEAUc33vMIftb_AQDWywjaACNWXDtW6hFWZwUxsX_hxl4eR0sLb3Df4iI9jXWREiJd4M-pkuozuobHwydkz52j2ejVUwHmMqI/s72-c/c-program-to-find-factorial.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-7882824510258149885</guid><pubDate>Sun, 07 Dec 2014 14:09:00 +0000</pubDate><atom:updated>2015-07-09T16:27:36.655+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Looping Programs</category><title>C Program To Print Even And Odd Numbers Using Loops</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjguSsE5VClySaOrfaow5x2OAGBwpvJuCgTCPbIajma47vb3xUA_Oi-9zQpHOblCW6q952x5oVLFWInONzjbQHUBVASCTfMX4VgMNU2jW3PAhsmnsI9jdCs6uWBkqroGL9XXHkHXxtLhtw/s1600/c-program-even-and-odd-number-list.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
We are going to write a c program to print the list of even and odd numbers. we can do this by using loops such as while loop, do while loop and for loop.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;font-size: 1.3em; line-height: 1.3em;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;font-size: 1.3em; line-height: 1.3em;&quot;&gt;C Program To Print Even and Odd Numbers Using While Loop&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n,last;
 clrscr();

 printf(&quot;\n Enter Last Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;last);

 //While Loop

 //Code For &lt;b&gt;Even Number List&lt;/b&gt;
 printf(&quot;\n Even Number List :\n &quot;);

 &lt;b&gt;n=2;
 while(n&amp;lt;=last)
 {
  printf(&quot; %d&quot;,n);
  n=n+2;
 }&lt;/b&gt;

 //Code For &lt;b&gt;Odd Number List&lt;/b&gt;
 printf(&quot;\n\n Odd Number List :\n &quot;);

 &lt;b&gt;n=1;
 while(n&amp;lt;=last)
 {
  printf(&quot; %d&quot;,n);
  n=n+2;
 }&lt;/b&gt;

 getch();

}&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;b&gt;Output:&lt;/b&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTFUlR5X7iSSAVzR4dYR8kzS81H4yvFq-LcZTO2wpnfSIQpAXaVq51F3EbFRkq4RhkLTj7Jwcg03J-TclcBb09XlxChEQ89l3jVMHkcuc7D0FoTfjofPtHCvg5cTPPvDiiPghXOA24g4o/s1600/Output+C+Program+Even+Odd+Number+List.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-C-Program-Even-Odd-Number-List&quot; border=&quot;0&quot; height=&quot;180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTFUlR5X7iSSAVzR4dYR8kzS81H4yvFq-LcZTO2wpnfSIQpAXaVq51F3EbFRkq4RhkLTj7Jwcg03J-TclcBb09XlxChEQ89l3jVMHkcuc7D0FoTfjofPtHCvg5cTPPvDiiPghXOA24g4o/s400/Output+C+Program+Even+Odd+Number+List.PNG&quot; title=&quot;Output-C-Program-Even-Odd-Number-List&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;In the above program,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;
&lt;li style=&quot;margin-bottom: 1em;&quot;&gt;We have initialized the values of even and odd numbers from 2 and 1 respectively.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 1em;&quot;&gt;Then we have printed each number and increased it by two in the next iteration using&amp;nbsp;loop&amp;nbsp;to get the next even or odd number respectively.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;Display Even and Odd Number List Using Do While Loop&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;When using &lt;/span&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cprogramming/c_do_while_loop.htm&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;do while loop&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; the condition is declared after the first iteration as shown below.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n,last;
 clrscr();

 printf(&quot;\n Enter Last Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;last);

 // Do_While Loop

 // Code for &lt;b&gt;Even Number list&lt;/b&gt;
 printf(&quot;\n Even Number List :\n &quot;);

 &lt;b&gt;n=2;
 do
  {
   printf(&quot; %d&quot;,n);
   n=n+2;

  } while(n&amp;lt;=last);&lt;/b&gt;

 // Code for &lt;b&gt;Odd Number List&lt;/b&gt;
 printf(&quot;\n\n Odd Number List :\n &quot;);

 &lt;b&gt;n=1;
  do
  {
   printf(&quot; %d&quot;,n);
   n=n+2;

  } while(n&amp;lt;=last);&lt;/b&gt;

 getch();
 }&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 31.2000007629395px; letter-spacing: -1px; line-height: 40.560001373291px;&quot;&gt;C Program To Print Even and Odd Numbers Using For Loop&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n,last;
 clrscr();

 printf(&quot;\n Enter Last Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;last);

 //  For loop
 // Code For &lt;b&gt;Even Number List&lt;/b&gt;
 printf(&quot;\n Even Number List :\n &quot;);

 &lt;b&gt;for(n=2;n&amp;lt;=last;n+=2)
  {
    printf(&quot; %d&quot;,n);
  }&lt;/b&gt;

 // Code For &lt;b&gt;Odd Number List&lt;/b&gt;
 printf(&quot;\n\n Odd Number List :\n &quot;);

 &lt;b&gt;for(n=1;n&amp;lt;=last;n+=2)
 {
   printf(&quot; %d&quot;,n);
 }&lt;/b&gt;

 getch();

}&lt;/pre&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;We can also use the method we used to &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/even-or-odd-number-if-else-switch-case.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;find even or odd number in c&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; to print the list of odd and even numbers.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;font-size: 31.2000007629395px; line-height: 40.560001373291px;&quot;&gt;C Program To Print Even and Odd Numbers&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n,i,last;
 clrscr();

 printf(&quot;\n Enter Last Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;last);

 printf(&quot;\n Even Number List :\n &quot;);

 for(i=1;i&amp;lt;=last;i++)
 {
   &lt;b&gt;if(i%2==0)&lt;/b&gt;
    {
      printf(&quot; %d&quot;,i);
    }
 }

 printf(&quot;\n\n Odd Number List :\n &quot;);

 for(i=1;i&amp;lt;=last;i++)
 {
   &lt;b&gt;if(i%2!=0)&lt;/b&gt;
    {
      printf(&quot; %d&quot;,i);
    }
 }

  getch();
}
&lt;/pre&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;This way we can print even and odd numbers list in c programming.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/print-even-and-odd-number-list.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjguSsE5VClySaOrfaow5x2OAGBwpvJuCgTCPbIajma47vb3xUA_Oi-9zQpHOblCW6q952x5oVLFWInONzjbQHUBVASCTfMX4VgMNU2jW3PAhsmnsI9jdCs6uWBkqroGL9XXHkHXxtLhtw/s72-c/c-program-even-and-odd-number-list.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-144025110660317666</guid><pubDate>Sun, 07 Dec 2014 09:09:00 +0000</pubDate><atom:updated>2015-06-24T14:59:56.779+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Looping Programs</category><title>C Program To Print Numbers From 10 To 1 Using Loop</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgJUaeKZ3WtczIZC2qfXNTK5gMyM_2mLNNz6I32-emPR1TjXiDvfYHgr_evKM3yr9XfppxRP7nL0UYR_8T8a7Lqwbvl7iM_U_DHDJrfq9aKBTqcGpSdYtQfhuG2y50xN2oCYfmNtz0QWw/s1600/c-program-print-10-1-numbers.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
This c program will print 10 to 1 numbers in descending order. We will perform this program using While Loop, Do While Loop and For Loop.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;
C Program To Print 10 to 1 Numbers Using While Loop&lt;/span&gt;&lt;/h2&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n;
 clrscr();

 printf(&quot;\n&quot;); //for new line

 // While Loop

 n=10;         //Initialize
 while(n&amp;gt;=1)   // Condition
 {
  printf(&quot; %d&quot;,n);
  n--;     // Decrement
 }

 getch();

}&lt;/pre&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Also Check:&amp;nbsp;&lt;/span&gt;&lt;em&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-print-natural-numbers.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;C Program To Print 1-10 Numbers Using while,do-while and for&amp;nbsp;loop&lt;/span&gt;&lt;/a&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;strong&gt;Output :&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYsFy2dbl57d89ftOolqH9y2GjHQi465rRB6j-D4dANfPIHTOcYmu2m6Bd-Xg8DmYtuU0KRmnmUWd9-3V4Hj31OYWOhNmX9MjqHFzNZJi5eKnmBEsi2EehsCYlbsqdb34G7vxkHZBB55l2/s1600/numbers-10-1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-print-10-1-numbers-output&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYsFy2dbl57d89ftOolqH9y2GjHQi465rRB6j-D4dANfPIHTOcYmu2m6Bd-Xg8DmYtuU0KRmnmUWd9-3V4Hj31OYWOhNmX9MjqHFzNZJi5eKnmBEsi2EehsCYlbsqdb34G7vxkHZBB55l2/s1600/numbers-10-1.jpg&quot; title=&quot;c-program-print-10-1-numbers-output&quot; /&gt;&lt;/a&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;
Display 10-1 Numbers using do..while loop&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n;
 clrscr();

 printf(&quot;\n&quot;); //for new line

 // Do While Loop
 n=10;  // Initialize
 do
  {
   printf(&quot; %d&quot;,n);
   n--;          // Decrement
  }
  while(n&amp;gt;=1); // Condition


 getch();
 }&lt;/pre&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program To Print Numbers From 10 To 1 Using For Loop&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n;
 clrscr();

 printf(&quot;\n&quot;); //for new line

  //  For loop
 //  (initialize; condition ; increment)

 for(n=10;n&amp;gt;=1;n--)
 {
   printf(&quot; %d&quot;,n);
 }

 getch();

}&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
To Run this program in DevC++ we have to make some changes in the above program, after changes the code will look like this:&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;

int main()
{
 int n;
 
 printf(&quot;\n&quot;); //for new line

  //  For loop
 //  (initialize; condition ; increment)

 for(n=10;n&amp;gt;=1;n--)
 {
   printf(&quot; %d&quot;,n);
 }

 getch();
return 0;
}&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;strong&gt;Output :&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkSnCwAiF6RqS666eJJT-3EjwZNryE94hLwts6ChT2aDVU9Qy6mcX6qI3CmYOi-sSmlpQoWzegmO6ZSMbb1cGPfyAHsXxYq3yUkJrlc88xR6Xd7RS77IhUVFdtNwu3faJMQj9H0kCQYIk/s1600/c-program-print-10-1-numbers-output.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-print-10-1-numbers-output&quot; border=&quot;0&quot; height=&quot;106&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkSnCwAiF6RqS666eJJT-3EjwZNryE94hLwts6ChT2aDVU9Qy6mcX6qI3CmYOi-sSmlpQoWzegmO6ZSMbb1cGPfyAHsXxYq3yUkJrlc88xR6Xd7RS77IhUVFdtNwu3faJMQj9H0kCQYIk/s400/c-program-print-10-1-numbers-output.PNG&quot; title=&quot;c-program-print-10-1-numbers-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
In this way, we can easily display numbers in any range using different types of loops.&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-display-natural-numbers.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgJUaeKZ3WtczIZC2qfXNTK5gMyM_2mLNNz6I32-emPR1TjXiDvfYHgr_evKM3yr9XfppxRP7nL0UYR_8T8a7Lqwbvl7iM_U_DHDJrfq9aKBTqcGpSdYtQfhuG2y50xN2oCYfmNtz0QWw/s72-c/c-program-print-10-1-numbers.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-1255061923745391393</guid><pubDate>Sun, 07 Dec 2014 08:33:00 +0000</pubDate><atom:updated>2015-06-24T15:03:04.735+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Looping Programs</category><title>C Program To Print Numbers From 1 To 10 Using Loop</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh051QyePtrmykEBRTwBzOQdCjejsaqHRHv4SaCOCa_likSZ4oaTAzqh6Jd-mlnqqYqbaOKox04UNcmsCp5Rvdcir-FCUHBOWWNWdAZklEcqoC3jxwpSW6Le1MyA8Vot9TNRDij5VZOg_E/s1600/c-program-print-1-10-numbers.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #0d0d0d; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In this c program, you will learn how to to print 1-10 numbers, using three different types of loops viz. &lt;/span&gt;For Loop&lt;span style=&quot;color: #0d0d0d;&quot;&gt;, &lt;/span&gt;While Loop&lt;span style=&quot;color: #0d0d0d;&quot;&gt; and &lt;/span&gt;Do While Loop&lt;span style=&quot;color: #0d0d0d;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;We have learned how to print any statement or number&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;span style=&quot;font-family: Merriweather, Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp;in the &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/11/first-c-program-hello-world.html&quot; style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif;&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;First C Program&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt; Now we will print one to ten numbers using &lt;/span&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cprogramming/c_loops.htm&quot; style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif;&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;loops in c&amp;nbsp;programming&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cprogramming/c_loops.htm&quot; style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif;&quot; target=&quot;_blank&quot;&gt;.&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt; C Program To Display 1-10 Numbers Using While Loop&lt;/span&gt;&lt;span style=&quot;font-size: 1.3em;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n;
 clrscr();

 printf(&quot;\n&quot;); //for new line

 // While Loop

 n=1;         //Initialize
 while(n&amp;lt;=10)   // Condition
 {
  printf(&quot; %d&quot;,n);
  n++;    // Increment
 }

 getch();

}&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
There is a little bit of difference in the while and do while loop. In&amp;nbsp;while&amp;nbsp;loop, the condition is checked first and in do while loop the condition is checked after the first execution of the&amp;nbsp;codeblock.&lt;/div&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt; Using Do While Loop We can Print 1-10 Numbers as Follow:&lt;/span&gt;&lt;/h4&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n;
 clrscr();

 printf(&quot;\n&quot;); //for new line

 // Do While Loop
 n=1;  // Initialize
 do
  {
   printf(&quot; %d&quot;,n);
   n++;          // Increment
  }
  while(n&amp;lt;=10); // Condition


 getch();
 }&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
In three of these loops, &lt;b&gt;&lt;u&gt;For Loop&lt;/u&gt;&lt;/b&gt; is bit easy to use as it has the all the code to be used in single line&lt;/div&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-weight: normal; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program To Print Numbers From 1
To 10 Using For Loop&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n;
 clrscr();

 printf(&quot;\n&quot;); //for new line

  /*  For loop
  (initialize; condition ; increment) */

 for(n=1;n&amp;lt;=10;n++)
 {
   printf(&quot; %d&quot;,n);
 }

 getch();

}&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;strong&gt;Output :&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOq_WrW3-xfUjYhBM4xYYw9JvDz7eBccSCAHzl_XHUNa_TSfTA-H6h-yqMAedX5zxXGeFwNKlv0el6EYR9coLIr2uDiPbi9CoZdZ-Am_hVNJ4shYsCo546dLB6W6GNSPnu1p7hSOYhZTqO/s1600/number1-10.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-print-natural-numbers-output&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOq_WrW3-xfUjYhBM4xYYw9JvDz7eBccSCAHzl_XHUNa_TSfTA-H6h-yqMAedX5zxXGeFwNKlv0el6EYR9coLIr2uDiPbi9CoZdZ-Am_hVNJ4shYsCo546dLB6W6GNSPnu1p7hSOYhZTqO/s1600/number1-10.jpg&quot; title=&quot;c-program-print-natural-numbers-output&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt; Dev C++ Source Code to Print 1-10 Numbers Using For Loop&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;

int main()
{
 int n;

 printf(&quot;\n&quot;); 

 for(n=1;n&amp;lt;=10;n++)
 {
   printf(&quot; %d&quot;,n);
 }

 getch();
 
 return 0;
}&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/strong&gt; &lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;Output :&lt;/strong&gt;&lt;br /&gt;
&lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/strong&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFhqApz9S2G2GlJaNTS20mgx4sV2xaem1WcoSwHsfaH0inNOjrf5eU51oEKI8l6xc9g_kuWkVSIz3HkJaZQuoYvkBvK0uJoT0WuPFttTGJ36oYhrziJE7HUMrHJYkFo0NpnG4DXvqOWUE/s1600/c-program-print-natural-numbers-output.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-print-natural-numbers-output&quot; border=&quot;0&quot; height=&quot;121&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFhqApz9S2G2GlJaNTS20mgx4sV2xaem1WcoSwHsfaH0inNOjrf5eU51oEKI8l6xc9g_kuWkVSIz3HkJaZQuoYvkBvK0uJoT0WuPFttTGJ36oYhrziJE7HUMrHJYkFo0NpnG4DXvqOWUE/s400/c-program-print-natural-numbers-output.PNG&quot; title=&quot;c-program-print-natural-numbers-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/strong&gt; &lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/strong&gt; &lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/strong&gt; &lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
In this way, you can print 1-10 Numbers in C. Also, by modifying the code a little bit you can print the range of numbers you want, just change the&amp;nbsp;initial&amp;nbsp;and last values in the condition and that range will get printed on the output screen.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-print-natural-numbers.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh051QyePtrmykEBRTwBzOQdCjejsaqHRHv4SaCOCa_likSZ4oaTAzqh6Jd-mlnqqYqbaOKox04UNcmsCp5Rvdcir-FCUHBOWWNWdAZklEcqoC3jxwpSW6Le1MyA8Vot9TNRDij5VZOg_E/s72-c/c-program-print-1-10-numbers.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-5974986093772793515</guid><pubDate>Fri, 05 Dec 2014 14:24:00 +0000</pubDate><atom:updated>2015-07-06T15:58:20.740+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Conditional Programs</category><title>C Program To Calculate The Gross Salary Of A Person</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsSRFhzVmZX_NjqOWBVw3pnYkj2fuMQmZjMOr6SHH_2R0XONlD3rp7SK_YmPgfcp5cSKL7vCzEtTJRzt_8urT42ymR4lfg0JKv_4wBRsnnJpz8XxBPy8P5PwSg-vGuFY6qbZMqsTo6xdk/s1600/C-program-to-calculate-gross-salary-of-a-person.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
To find out gross salary, we are going to take the basic salary of a person as an input. Find out D.A. and T.A. according to basic salary and then add them all.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;C Program To Determine Gross Salary Of A Person&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;

void main()
{
   int basic;
   float gross,da, ta;
   clrscr();

   printf(&quot;\n Enter Basic Salary : &quot;);
   scanf(&quot;%d&quot;, &amp;amp;basic);

   da = 0.1 * basic;
   ta = 0.12 * basic;

   gross = basic + da + ta;

   printf(&quot;\n Your Gross Salary is : %.2f&quot;,gross);

   getch();
}&lt;/pre&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;Output:&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEdI8LTYiIq_9i8AV0uT3f6o550h6k8xCHoRh42UO2L-gFO3vrDpa43SFys3tOlKo61ZfRu5fR9R3VmZCnK0ygTGK-VsAP08f2QiFkDL3VeNm_vpNGcE1MHhpmYdXbBSi32s3g-Mv6vac/s1600/output-c-program-calculate-gross-salary.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Calculate-Gross-Salary-From-Basic-Salary&quot; border=&quot;0&quot; height=&quot;166&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEdI8LTYiIq_9i8AV0uT3f6o550h6k8xCHoRh42UO2L-gFO3vrDpa43SFys3tOlKo61ZfRu5fR9R3VmZCnK0ygTGK-VsAP08f2QiFkDL3VeNm_vpNGcE1MHhpmYdXbBSi32s3g-Mv6vac/s400/output-c-program-calculate-gross-salary.PNG&quot; title=&quot;Output-Calculate-Gross-Salary-From-Basic-Salary&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
In the above program, we calculated the gross salary of a single person by taking the basic salary. Now, we will calculate gross salary of different employees, according to their years of experience.&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
We will refer to the following chart.&lt;/div&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableLightListAccent5&quot; style=&quot;border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;background: #4BACC6; border: solid windowtext 1.0pt; mso-background-themecolor: accent5; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 96.85pt;&quot; valign=&quot;top&quot; width=&quot;129&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white; mso-themecolor: background1;&quot;&gt;Years Of Experience&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4BACC6; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: accent5; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 95.45pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white; mso-themecolor: background1;&quot;&gt;Basic&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white; mso-themecolor: background1;&quot;&gt;Salary&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4BACC6; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: accent5; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white; mso-themecolor: background1;&quot;&gt;Dearness Allowance&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4BACC6; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: accent5; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white; mso-themecolor: background1;&quot;&gt;Travelling Allowance&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: solid #4BACC6 1.0pt; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid #4BACC6 1.0pt; mso-border-bottom-themecolor: accent5; mso-border-left-themecolor: accent5; mso-border-right-alt: solid windowtext .5pt; mso-border-themecolor: accent5; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 96.85pt;&quot; valign=&quot;top&quot; width=&quot;129&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;gt;=25 years&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-bottom-alt: #4BACC6 1.0pt; mso-border-bottom-themecolor: accent5; mso-border-bottom-themecolor: accent5; mso-border-left-alt: solid windowtext .5pt; mso-border-left-alt: windowtext .5pt; mso-border-right-alt: windowtext .5pt; mso-border-style-alt: solid; mso-border-top-alt: #4BACC6 1.0pt; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 95.45pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp; &amp;nbsp; 50000&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-bottom-alt: #4BACC6 1.0pt; mso-border-bottom-themecolor: accent5; mso-border-bottom-themecolor: accent5; mso-border-left-alt: solid windowtext .5pt; mso-border-left-alt: windowtext .5pt; mso-border-right-alt: windowtext .5pt; mso-border-style-alt: solid; mso-border-top-alt: #4BACC6 1.0pt; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2%&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: none; border-right: solid #4BACC6 1.0pt; border-top: none; mso-border-bottom-themecolor: accent5; mso-border-left-alt: solid windowtext .5pt; mso-border-right-themecolor: accent5; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4%&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 96.85pt;&quot; valign=&quot;top&quot; width=&quot;129&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;gt;=10 years&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 95.45pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp; &amp;nbsp; 30000&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2%&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4%&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: solid #4BACC6 1.0pt; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid #4BACC6 1.0pt; mso-border-bottom-themecolor: accent5; mso-border-left-themecolor: accent5; mso-border-right-alt: solid windowtext .5pt; mso-border-themecolor: accent5; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 96.85pt;&quot; valign=&quot;top&quot; width=&quot;129&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;gt;=5 years&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-bottom-alt: #4BACC6 1.0pt; mso-border-bottom-themecolor: accent5; mso-border-bottom-themecolor: accent5; mso-border-left-alt: solid windowtext .5pt; mso-border-left-alt: windowtext .5pt; mso-border-right-alt: windowtext .5pt; mso-border-style-alt: solid; mso-border-top-alt: #4BACC6 1.0pt; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 95.45pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp; &amp;nbsp; 20000&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-bottom-alt: #4BACC6 1.0pt; mso-border-bottom-themecolor: accent5; mso-border-bottom-themecolor: accent5; mso-border-left-alt: solid windowtext .5pt; mso-border-left-alt: windowtext .5pt; mso-border-right-alt: windowtext .5pt; mso-border-style-alt: solid; mso-border-top-alt: #4BACC6 1.0pt; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;5%&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: none; border-right: solid #4BACC6 1.0pt; border-top: none; mso-border-bottom-themecolor: accent5; mso-border-left-alt: solid windowtext .5pt; mso-border-right-themecolor: accent5; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7%&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 96.85pt;&quot; valign=&quot;top&quot; width=&quot;129&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;gt;=2 years&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 95.45pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp; &amp;nbsp; 12000&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;5%&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7%&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: solid #4BACC6 1.0pt; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid #4BACC6 1.0pt; mso-border-bottom-themecolor: accent5; mso-border-left-themecolor: accent5; mso-border-right-alt: solid windowtext .5pt; mso-border-themecolor: accent5; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 96.85pt;&quot; valign=&quot;top&quot; width=&quot;129&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;gt;2 years&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-bottom-alt: #4BACC6 1.0pt; mso-border-bottom-themecolor: accent5; mso-border-bottom-themecolor: accent5; mso-border-left-alt: solid windowtext .5pt; mso-border-left-alt: windowtext .5pt; mso-border-right-alt: windowtext .5pt; mso-border-style-alt: solid; mso-border-top-alt: #4BACC6 1.0pt; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 95.45pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;8000&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-bottom-alt: #4BACC6 1.0pt; mso-border-bottom-themecolor: accent5; mso-border-bottom-themecolor: accent5; mso-border-left-alt: solid windowtext .5pt; mso-border-left-alt: windowtext .5pt; mso-border-right-alt: windowtext .5pt; mso-border-style-alt: solid; mso-border-top-alt: #4BACC6 1.0pt; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;6%&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid #4BACC6 1.0pt; border-left: none; border-right: solid #4BACC6 1.0pt; border-top: none; mso-border-bottom-themecolor: accent5; mso-border-left-alt: solid windowtext .5pt; mso-border-right-themecolor: accent5; mso-border-top-alt: solid #4BACC6 1.0pt; mso-border-top-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 95.7pt;&quot; valign=&quot;top&quot; width=&quot;128&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8%&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-weight: normal; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program To Calculate Gross Salary Of An Employee&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int y;
 float basic,ta,da,gross;
 clrscr();

 printf(&quot;\n Enter Your Years Of Experience : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;y);
 printf(&quot;\n *********************************&quot;);

 // Ladder If Statement //

 if(y&amp;gt;=25)
   {
     basic=50000;
     da=0.02*basic;
     ta=0.04*basic;
     gross=basic+da+ta;
   }

 else if(y&amp;gt;=10)
   {
     basic=30000;
     da=0.02*basic;
     ta=0.04*basic;
     gross=basic+da+ta;
   }

 else if(y&amp;gt;=5)
   {
     basic=20000;
     da=0.05*basic;
     ta=0.07*basic;
     gross=basic+da+ta;
   }

 else if(y&amp;gt;=2)
   {
     basic=12000;
     da=0.05*basic;
     ta=0.07*basic;
     gross=basic+da+ta;
   }

 else
   {
     basic=8000;
     da=0.06*basic;
     ta=0.08*basic;
     gross=basic+da+ta;
   }


 printf(&quot;\n\n Your Basic Salary is: %.0f&quot;,basic);

 printf(&quot;\n\n Your Gross Salary is : %.2f&quot;,gross);
 printf(&quot;\n\n *********************************&quot;);

 getch();
}&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;Output:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinXDzjrQQCpafvQAyD1Q3RF9HLaZUuDzy4ol4xJiwraECppPyAVVFxdy5pEUv80RBCgLR7MUOfduItR5XPlzUFtMZVqVPmURSe35lSqG2Ij4KQA_5ICJofEeINwQAYBHk2g4VMg5Tr05U/s1600/output-c-program-calculate-gross-salary-employee.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;output-c-program-calculate-gross-salary-employee&quot; border=&quot;0&quot; height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinXDzjrQQCpafvQAyD1Q3RF9HLaZUuDzy4ol4xJiwraECppPyAVVFxdy5pEUv80RBCgLR7MUOfduItR5XPlzUFtMZVqVPmURSe35lSqG2Ij4KQA_5ICJofEeINwQAYBHk2g4VMg5Tr05U/s400/output-c-program-calculate-gross-salary-employee.PNG&quot; title=&quot;output-c-program-calculate-gross-salary-employee&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
In this way, we can calculate the gross salary of a person or employees using this c program.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-to-calculate-gross-salary-of-person.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsSRFhzVmZX_NjqOWBVw3pnYkj2fuMQmZjMOr6SHH_2R0XONlD3rp7SK_YmPgfcp5cSKL7vCzEtTJRzt_8urT42ymR4lfg0JKv_4wBRsnnJpz8XxBPy8P5PwSg-vGuFY6qbZMqsTo6xdk/s72-c/C-program-to-calculate-gross-salary-of-a-person.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-8560893181714698714</guid><pubDate>Fri, 05 Dec 2014 10:49:00 +0000</pubDate><atom:updated>2015-07-04T12:02:11.090+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basic Programs</category><category domain="http://www.blogger.com/atom/ns#">Conditional Programs</category><title>C Program To Find Grades Of A Student Using Else If Ladder</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeH5qAkhcdcxDuZ5QQoxcGBUrS2oDTu4IUW1Gy3CW5ljyZGKrpsWK8QiaPCvESx98kHJxNK6fhVbRKjp6rcemfZWtqNyC-Tb4ztHfvUWrLp_SO1LB8p3ZouKb0RhjicKeXTPGgFy8FA24/s1600/c-program-to-find-grades-of-student.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In the previous program, we have seen how to &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-find-total-marks-and-average.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;calculate total marks and average&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;, in this program we will&amp;nbsp;see&amp;nbsp;how to give grades according to the marks&amp;nbsp;be obtained,&amp;nbsp;using the ladder if statement.&lt;/span&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
We will refer to the following Chart of &lt;i&gt;percentage and grades&lt;/i&gt;.&lt;/div&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableLightListAccent5&quot; style=&quot;border-collapse: collapse; border: none; text-align: center;&quot;&gt; &lt;tbody&gt;
&lt;tr style=&quot;height: 20.95pt; mso-yfti-firstrow: yes; mso-yfti-irow: -1;&quot;&gt;  &lt;td style=&quot;background: #4BACC6; border: solid windowtext 1.5pt; height: 20.95pt; mso-background-themecolor: accent5; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white; font-size: 16.0pt; mso-bidi-font-size: 14.0pt; mso-themecolor: background1;&quot;&gt;Percentage&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;  &lt;td style=&quot;background: #4BACC6; border-left: none; border: solid windowtext 1.5pt; height: 20.95pt; mso-background-themecolor: accent5; mso-border-left-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white; font-size: 16.0pt; mso-bidi-font-size: 14.0pt; mso-themecolor: background1;&quot;&gt;Grades&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;tr style=&quot;height: 20.95pt; mso-yfti-irow: 0;&quot;&gt;  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 20.95pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;&amp;gt;=80&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 20.95pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;A+&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;tr style=&quot;height: 20.95pt; mso-yfti-irow: 1;&quot;&gt;  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 20.95pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;&amp;gt;=75&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 20.95pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;A&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;tr style=&quot;height: 20.95pt; mso-yfti-irow: 2;&quot;&gt;  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 20.95pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;&amp;gt;=60&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 20.95pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;B&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;tr style=&quot;height: 20.95pt; mso-yfti-irow: 3;&quot;&gt;  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 20.95pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;&amp;gt;=45&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 20.95pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;C&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;tr style=&quot;height: 20.95pt; mso-yfti-irow: 4;&quot;&gt;  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 20.95pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: 21px;&quot;&gt;&lt;b&gt;&amp;gt;=35&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 20.95pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;D&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;tr style=&quot;height: 20.95pt; mso-yfti-irow: 5; mso-yfti-lastrow: yes;&quot;&gt;  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 20.95pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;&amp;lt;35&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 20.95pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 122.85pt;&quot; valign=&quot;top&quot; width=&quot;164&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: 16.0pt; mso-bidi-font-size: 14.0pt;&quot;&gt;Fail&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;h2 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program To Give Grades According To Mark Obtained&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int s1,s2,s3,s4,s5,t,p;
 clrscr();

 printf(&quot;\n Enter marks of 5 subjects each out of 100 &quot;);
 printf(&quot;\n\n ********************************************&quot;);

 printf(&quot;\n\n Maths = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;s1);

 printf(&quot;\n Science = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;s2);

 printf(&quot;\n English = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;s3);

 printf(&quot;\n History = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;s4);

 printf(&quot;\n Geography = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;s5);
 printf(&quot;\n ********************************************&quot;);

 t=s1+s2+s3+s4+s5;  //Total
 printf(&quot;\n Total marks = %d/500&quot;,t);

 p=t/5;  //Percentage
 printf(&quot;\n\n Percentage = %d%&quot;,p);
 printf(&quot;\n ********************************************&quot;);

//////////// Ladder If Statement ////////////
 if(p&amp;gt;=80)
    printf(&quot;\n\n Your Grade : A+&quot;);

   else if(p&amp;gt;=75)
     printf(&quot;\n\n Your Grade : A&quot;);

     else if(p&amp;gt;=60)
       printf(&quot;\n\n Your Grade : B&quot;);

        else if(p&amp;gt;=45)
          printf(&quot;\n\n Your Grade : C&quot;);

            else if(p&amp;gt;=35)
              printf(&quot;\n\n Your grade : D&quot;);

   else
     printf(&quot;\n\n You Are Fail&quot;);

 //////// Ladder If Statement /////////////

 getch();
}&lt;/pre&gt;
&lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt; &lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;em&gt;Output :&amp;nbsp;&lt;/em&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg613zXJbtjvrGTmYnHJ50JnHWjXJ7J7FzKnlEkF-1ZSMx2nswh9OuRnYdD6up9sUoUvkFHwmI09m8mgQz3TVtVb82Qw69aqCKFdQpYi5bT3h6WKWf_qk4v_QPVrqV5uR7DVCvIUavvGqQy/s1600/grades.jpg&quot; style=&quot;clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;c-program-to-find-grades-output&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg613zXJbtjvrGTmYnHJ50JnHWjXJ7J7FzKnlEkF-1ZSMx2nswh9OuRnYdD6up9sUoUvkFHwmI09m8mgQz3TVtVb82Qw69aqCKFdQpYi5bT3h6WKWf_qk4v_QPVrqV5uR7DVCvIUavvGqQy/s1600/grades.jpg&quot; title=&quot;c-program-to-find-grades-output&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
This way we have written a c program to find grades using an else if ladder statement.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-find-grades-if-ladder.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeH5qAkhcdcxDuZ5QQoxcGBUrS2oDTu4IUW1Gy3CW5ljyZGKrpsWK8QiaPCvESx98kHJxNK6fhVbRKjp6rcemfZWtqNyC-Tb4ztHfvUWrLp_SO1LB8p3ZouKb0RhjicKeXTPGgFy8FA24/s72-c/c-program-to-find-grades-of-student.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-2776861642770307885</guid><pubDate>Fri, 05 Dec 2014 08:37:00 +0000</pubDate><atom:updated>2015-07-02T12:01:52.567+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Conditional Programs</category><title>C Program To Find Smallest Of Two Numbers Using Operators</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXiIUsN620F5MCAepZHdy0GC5mkVazLE_lDj-17Ywky-WsHl6BqRKq1-YHeYfftmMYlPdVBWa87kVzM2hyphenhyphenKTtaotMe9oa_fNwk2fgurXnDKWvaHdGeZAAN9vNb6H45fXGML0rVW-AbKxg/s1600/c-program-smallest-of-two-numbers.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div style=&quot;font-size: 24px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #0d0d0d; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;This c program will teach you, how to find smallest of two given numbers using logical operator, &lt;/span&gt;&lt;a href=&quot;http://www.c4learn.com/c-programming/c-conditional-operators/&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;conditional or ternary operator&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; and arithmetical operator.&lt;/span&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3 style=&quot;color: #0d0d0d; line-height: 1.2em;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt; C Program To Determine Smallest Of &amp;nbsp;Two Numbers Using Logical Operator.&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
  int a,b;
  clrscr();

  printf(&quot;\n Enter any Two numbers\n&quot;);

  printf(&quot;\n Enter First Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;a);

  printf(&quot;\n Enter Second Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;b);

  if(a&amp;lt;b)   //logical test
   {
    printf(&quot;\n %d is Smaller&quot;,a);
   }
  else
   {
    printf(&quot;\n %d is Smaller&quot;,b);
   }

 getch();
}&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Output :&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIFXwneFs7f6VUT3dUb7Fx1sMFuturEWhCk5U3a719JAS2LDbNpJv5FN7BjrJbrxhCVb8DFjXZxjb0bFIv3gF9KCIT7RYsnRPADIYpmzsG0LkudesEsQsI-hr37NrYPViki-iro802NCPD/s1600/smaller_from_2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-smallest-of-two-numbers-output&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIFXwneFs7f6VUT3dUb7Fx1sMFuturEWhCk5U3a719JAS2LDbNpJv5FN7BjrJbrxhCVb8DFjXZxjb0bFIv3gF9KCIT7RYsnRPADIYpmzsG0LkudesEsQsI-hr37NrYPViki-iro802NCPD/s1600/smaller_from_2.jpg&quot; title=&quot;c-program-smallest-of-two-numbers-output&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt; C Program To Calculate Smallest Of Two Numbers Using Conditional Operator/ Ternary Operator&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
  int a,b,c;
  clrscr();

  printf(&quot;\n Enter any Two numbers\n&quot;);

  printf(&quot;\n Enter First Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;a);

  printf(&quot;\n Enter Second Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;b);

  c=(a&amp;lt;b) ? a : b ;   // Conditional operator

  printf(&quot;\n %d is Smaller&quot;,c);

  getch();
}&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;We have also used the conditional operator to &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-greatest-two-numbers.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;find greatest of two numbers&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; in c, here the condition changes from (a&amp;gt;b) to (a&amp;lt;b) give us the smaller number.&lt;/span&gt;&lt;/div&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt; C Program To Find Smallest of Two Numbers Using Arithmetical Operator.&lt;/span&gt;&lt;/h4&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
  int a,b,c;
  clrscr();

  printf(&quot;\n Enter any Two numbers\n&quot;);

  printf(&quot;\n Enter First Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;a);

  printf(&quot;\n Enter Second Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;b);

  c=a-b;

  if(c&amp;lt;0)
  printf(&quot;\n %d is Smaller&quot;,a);

  else
  printf(&quot;\n %d is Smaller&quot;,b);

 getch();
}&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; white-space: normal;&quot;&gt;
In the above code,&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;First we get two numbers from user and subtract the first one from second.&lt;/li&gt;
&lt;li&gt;If the subtraction is a negative number that means first number (a) is smaller than the second one (b), for example if we take a=4 and b=5 then a-b will be equal to -1 which is a negative number. It means the first number is smaller.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;On the contrary if the subtraction is a positive number the second number (b) is smaller than the first one.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left; white-space: normal;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt; Dev C++ Code for the above program&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
int main()
{
  int a,b;
  printf(&quot;\n Enter Any Two numbers\n&quot;);
  
  printf(&quot;\n Enter First Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;a);
  printf(&quot;\n Enter Second Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;b);

  if(a&amp;lt;b)//logical test
   {
    printf(&quot;\n %d is Smaller&quot;,a);
   }
  else
   {
    printf(&quot;\n %d is Smaller&quot;,b);
   }
 getch();
 return 0;
}&lt;span style=&quot;font-size: large;&quot;&gt; &lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;b&gt;Output :&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCGOb8sOZOxQXncvahklVvvWKVjOlyYAU7UZWDDRVkZwZ6aWpmP5OyEVPowKoeg5eR8gjqqQrGpqMmzSJ1RSDUVqLQeGjxLx6j_zvMrSwmIxtFdL-JX7VnUpy-uGtnaDW2iqAP9BeTSn0/s1600/c-program-smallest-of-two-numbers-output.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;c-program-smallest-of-two-numbers-output&quot; border=&quot;0&quot; height=&quot;128&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCGOb8sOZOxQXncvahklVvvWKVjOlyYAU7UZWDDRVkZwZ6aWpmP5OyEVPowKoeg5eR8gjqqQrGpqMmzSJ1RSDUVqLQeGjxLx6j_zvMrSwmIxtFdL-JX7VnUpy-uGtnaDW2iqAP9BeTSn0/s400/c-program-smallest-of-two-numbers-output.png&quot; title=&quot;c-program-smallest-of-two-numbers-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-smallest-two-numbers.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXiIUsN620F5MCAepZHdy0GC5mkVazLE_lDj-17Ywky-WsHl6BqRKq1-YHeYfftmMYlPdVBWa87kVzM2hyphenhyphenKTtaotMe9oa_fNwk2fgurXnDKWvaHdGeZAAN9vNb6H45fXGML0rVW-AbKxg/s72-c/c-program-smallest-of-two-numbers.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-5617807709625785826</guid><pubDate>Fri, 05 Dec 2014 08:13:00 +0000</pubDate><atom:updated>2015-07-02T12:01:08.615+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Conditional Programs</category><title>C Program To Find Greatest Of Two Numbers Using Operators</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpTz_29uvj-uYDHT2dE2GjMlmGS84PMDjuHCxNsv25o8Hwg7w0r3wP4bfz-Pj1YqD7kLQeC2vvGjxOrIVyU4dYCBpxU8wRivNK44_SISQJhGrF1FIvfCGUtSyrWdxAc2nmZ_WnI93OLIc/s1600/c-program-greatest-of-two-numbers.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
In this c program, you are going to find the greatest of two numbers, by&amp;nbsp;taking the two numbers from a user as an input.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt; C Program To Find Which Number is Greater From Two Given Numbers&lt;/span&gt;&lt;/h2&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
  int a,b;
  clrscr();

  printf(&quot;\n Enter any Two numbers\n&quot;);

  printf(&quot;\n Enter First Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;a);

  printf(&quot;\n Enter Second Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;b);

  if(a&amp;gt;b)//logical test
   {
    printf(&quot;\n %d is Greater&quot;,a);
   }

  else
   {
    printf(&quot;\n %d is Greater&quot;,b);
   }

 getch();
}&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Output :&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJoSjOevajR1n_1Jt8ArCACVaoXMTqOTSPUISGLPswgOxEL9ogmI_ED5us6jElRaoUNkuyA6J_ywBbSttCu5An3qG5b-Wg2RaJrwc4Kd1Pnl6rv6bCMdUYFdsXrBTgI0pxwkdtv0X94fOx/s1600/greater_from_2.jpg&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-greatest-of-two-numbers-output&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJoSjOevajR1n_1Jt8ArCACVaoXMTqOTSPUISGLPswgOxEL9ogmI_ED5us6jElRaoUNkuyA6J_ywBbSttCu5An3qG5b-Wg2RaJrwc4Kd1Pnl6rv6bCMdUYFdsXrBTgI0pxwkdtv0X94fOx/s1600/greater_from_2.jpg&quot; title=&quot;c-program-greatest-of-two-numbers-output&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Likewise we can also write a &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-smallest-two-numbers.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;c program to find smallest of two numbers using operators&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
There are several other methods to perform the same program, we will see two of them, one is by the use of a conditional&amp;nbsp;operator and the second is by using arithmetical operator.&lt;br /&gt;
&lt;br /&gt;
Read More&lt;span style=&quot;color: #0d0d0d;&quot;&gt; &amp;nbsp;About &lt;/span&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cprogramming/c_operators.htm&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;Operators in C&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;C Program To Find Greatest Of Two Numbers Using Conditional Operator/Ternary Operator&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
  int a,b,c;
  clrscr();

  printf(&quot;\n Enter any Two numbers\n&quot;);

  printf(&quot;\n Enter First Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;a);

  printf(&quot;\n Enter Second Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;b);

  c=(a&amp;gt;b) ? a : b ;   // Conditional operator

  printf(&quot;\n %d is Greater&quot;,c);

  getch();
}&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In the above program, we have used &lt;/span&gt;&lt;a href=&quot;http://www.c4learn.com/c-programming/c-conditional-operators/&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;&lt;b&gt;conditional / ternary&lt;/b&gt; &lt;b&gt;operator&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;General format of &lt;u&gt;conditional operator&lt;/u&gt;:&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #9fc5e8;&quot;&gt;( Condition ? &amp;nbsp;Statements&amp;nbsp;1 :&amp;nbsp;Statements 2 )&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Working :&lt;/u&gt;&lt;/b&gt; This operator works same as the If..Else.. statement,&amp;nbsp;condition is declared before the question mark, if the condition is true, statements after the question mark will be executed and if the condition turns out to be false statements after the colon will be executed.&lt;/div&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;Find Greater Number From Two Using Arithmetical Operator&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
  int a,b,c;
  clrscr();

  printf(&quot;\n Enter any Two numbers\n&quot;);

  printf(&quot;\n Enter First Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;a);

  printf(&quot;\n Enter Second Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;b);

  c=a-b;

  if(c&amp;gt;0)
  printf(&quot;\n %d is Greater&quot;,a);

  else
  printf(&quot;\n %d is Greater&quot;,b);

 getch();
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-size: 24px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
As shown in this source code above,&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;We get two numbers from the user&amp;nbsp;and subtract the second&amp;nbsp;number from the first one.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;If the subtraction is positive (i.e greater than 0) means the first number is greater&amp;nbsp;&lt;/li&gt;
&lt;li&gt;If the subtraction is negative (i.e less than 0) then the second number is greater.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 24px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Also&amp;nbsp;Read:&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-positive-negative-number.html&quot; target=&quot;_blank&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;C Program To Check If Given Number Is Positive Or Negative&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h4 style=&quot;color: #0d0d0d; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;C program for Dev C++ to find greater number from two given Numbers&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot; style=&quot;color: #0d0d0d;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
int main()
{
  int a,b;
  printf(&quot;\n Enter Any Two numbers\n&quot;);
  printf(&quot;\n Enter First Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;a);
  printf(&quot;\n Enter Second Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;b);

  if(a&amp;gt;b)//logical test
   {
    printf(&quot;\n %d is Greater&quot;,a);
   }
  else
   {
    printf(&quot;\n %d is Greater&quot;,b);
   }
 getch();
 return 0;
}&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #0d0d0d; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWQ6ZB1Qb9W11in9GIsX722KgoVXTCrRZ2nshuk_xde0JEO_8WGJP9T1bgBSk6_Rojl20iFy8HrN5pcdlvXs40lpYmIndxYwHbbF-xCmFkweNpkknO0XBdZSqYmwY8M9iQGK7TADMJVHU/s1600/c-program-greatest-of-two-numbers-output.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-greatest-of-two-numbers-output&quot; border=&quot;0&quot; height=&quot;128&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWQ6ZB1Qb9W11in9GIsX722KgoVXTCrRZ2nshuk_xde0JEO_8WGJP9T1bgBSk6_Rojl20iFy8HrN5pcdlvXs40lpYmIndxYwHbbF-xCmFkweNpkknO0XBdZSqYmwY8M9iQGK7TADMJVHU/s400/c-program-greatest-of-two-numbers-output.png&quot; title=&quot;c-program-greatest-of-two-numbers-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-size: 24px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;br /&gt;
We have seen how to write a&amp;nbsp;&lt;em&gt;C program to find the greatest number from two given numbers&lt;/em&gt;&amp;nbsp;in various ways.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-greatest-two-numbers.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpTz_29uvj-uYDHT2dE2GjMlmGS84PMDjuHCxNsv25o8Hwg7w0r3wP4bfz-Pj1YqD7kLQeC2vvGjxOrIVyU4dYCBpxU8wRivNK44_SISQJhGrF1FIvfCGUtSyrWdxAc2nmZ_WnI93OLIc/s72-c/c-program-greatest-of-two-numbers.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-6883122080664350993</guid><pubDate>Fri, 05 Dec 2014 07:44:00 +0000</pubDate><atom:updated>2015-07-23T22:51:43.733+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Conditional Programs</category><title>C Program To Check Whether A Person Is Eligible To Vote</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPEqcoWO3Oe7p7PhDuKRVAou7uivAgBwYYMa5t5skLhX40LcxIxuHfmkJLcL_Yw6fN7SLEfkSUHPExXDV6aj5r_V9gnTR1vMLg0U0ZyLir88A7M7hMeZgu4NIGRAXn2wcs2WLNkTAGUpg/s1600/c-program-to-check-person-is-eligible-for-vote.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
We are going to write a program in c which can check if the candidate is eligible to vote or not. We can do this by using a simple if-else statement.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px; text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program For Checking Voter Eligibility&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
int age;
char name[50]; // or *name
clrscr();

 printf(&quot;\n Type the Name of the candidate: &quot;);
 gets(name);

 printf(&quot;\n Enter The Age : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;age);

 if(age&amp;gt;=18)
  {
    printf(&quot;\n %s is Eligible for Vote&quot;,name);
  }
 else
  {
    printf(&quot;\n %s is Not Eligible for Vote&quot;,name);
  }

 getch();
}&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Output :&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX-UjibVd8vhq0LzcF04utEuuV4wLLZDlI_GrHEX_C4bjSfzbwi9YnzAv4hAfMC7msShKa4Tkf0pubT_miAplw_cnpaN2FdK6hoJbgsEaABRPWo4b96MWcDb75FYIsYO03KSUmviPFd25Y/s1600/voter_eligibility_1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-C-Program-Eligible-For-Vote&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX-UjibVd8vhq0LzcF04utEuuV4wLLZDlI_GrHEX_C4bjSfzbwi9YnzAv4hAfMC7msShKa4Tkf0pubT_miAplw_cnpaN2FdK6hoJbgsEaABRPWo4b96MWcDb75FYIsYO03KSUmviPFd25Y/s1600/voter_eligibility_1.jpg&quot; title=&quot;Output-C-Program-Eligible-For-Vote&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibH2CdRtmGD2hCFDJq7mHQ6ut8KyPA88NWLcW43IokJQPVbLCpvoXGT7weqJFJ9hYPsTi6CW0KMwEHyY6WjwY23ihLAvOuSKtwgBANEHwHylg_qa824FjmyTXTy6_EFEdT0mANIaOw6HrK/s1600/voter_eligibility_2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Not-Eligible-For-Vote&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibH2CdRtmGD2hCFDJq7mHQ6ut8KyPA88NWLcW43IokJQPVbLCpvoXGT7weqJFJ9hYPsTi6CW0KMwEHyY6WjwY23ihLAvOuSKtwgBANEHwHylg_qa824FjmyTXTy6_EFEdT0mANIaOw6HrK/s1600/voter_eligibility_2.jpg&quot; title=&quot;Output-Not-Eligible-For-Vote&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
In the above program, we have declared a variable &#39;age&#39; for age and a character string &#39;name[50]&#39; for the name of the candidate.&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Then we get the values of name from the user using the gets() function. We can also use the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/11/take-input-from-user-using-scanf.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;scanf() function&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&amp;nbsp;to get the string values from the user as we have used it to get the value of age. But the problem with&amp;nbsp;&lt;/span&gt;scanf&lt;span style=&quot;color: #0d0d0d;&quot;&gt;() is you can&#39;t get spaces in it. Meaning if a user Enters: &#39;Name&#39; &#39;Surname&#39; only the Value of &#39;Name&#39; will get stored in the variable.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
Now to decide if a person is eligible for&amp;nbsp;voting or not we have simply used an if-else statement.&lt;/div&gt;
&lt;pre&gt;Similar programs we can do using if-else statment : 

&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;1. &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/even-or-odd-number-if-else-switch-case.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Find Even Or Odd Number&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: blue;&quot;&gt;

2. &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-positive-negative-number.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Find Positive Or Negative Number&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: blue;&quot;&gt;

3. &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-greatest-two-numbers.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Find Greatest&lt;/span&gt;&lt;/a&gt; and &lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-smallest-two-numbers.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Smallest Number&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
Here in India the eligibility criteria for a candidate to vote is the person should be 18 years of age or greater. So we will Check the age is greater than or equal to 18. (You can change this condition according to your country and regulations.)&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -0.699999988079071px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
If the Age is less than 18 that person is not eligible for vote else the person is eligible for voting.&lt;br /&gt;
&lt;br /&gt;
In this way, we can decide whether a person is eligible to vote or not in c programming.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/check-whether-eligible-for-vote-or-not.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPEqcoWO3Oe7p7PhDuKRVAou7uivAgBwYYMa5t5skLhX40LcxIxuHfmkJLcL_Yw6fN7SLEfkSUHPExXDV6aj5r_V9gnTR1vMLg0U0ZyLir88A7M7hMeZgu4NIGRAXn2wcs2WLNkTAGUpg/s72-c/c-program-to-check-person-is-eligible-for-vote.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-3650149841753366966</guid><pubDate>Fri, 05 Dec 2014 07:10:00 +0000</pubDate><atom:updated>2015-07-18T19:45:12.121+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Conditional Programs</category><title>C Program To Find The Given Number Is Even Or Odd</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi98AwexvSY7knrcI7uJ6CAAUprR1kfJqeYk9Wkewhxn8ARlcMgn0Ixf7hyphenhyphen1SMJkk9eiJQqCiG5UxA1tDTsl6495J0EXseMNgvsLEQKgAnDHWKsyuOLCUQV_8YVvtBtMQIcfQAos0UZWRs/s1600/c-program-even-or-odd-number.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-size: 24px;&quot;&gt;We are going to write a c program to find even or odd number, we can determine this by using if-else,&amp;nbsp;switch case or the conditional operator. Also, we can use functions.&lt;/span&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program to Check Whether a Number is Even or Odd&amp;nbsp;Using If-Else&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In the following program, we will check if the entered&amp;nbsp;number is completely divisible by 2. To check this, we will use &lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Modulo_operation&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;Modulus Operator&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;(%). This operator will return the remainder of the division. If the remainder is zero that means the number is completely divisible by 2 and is even number else it will be an odd number.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
int n;
clrscr();

 printf(&quot;\n Enter Any Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 if(&lt;b&gt;n%2==0&lt;/b&gt;)
  {
    printf(&quot;\n %d is Even number&quot;,n);
  }
 else
  {
    printf(&quot;\n %d is Odd number&quot;,n);
  }

 getch();
}
&lt;/pre&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;b&gt;Output :&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzJ7PoO5OmsuSNpQQEJNjeykDNw-_EEObHSAYEAK75u8Pcv9kSWmM89P9qFURcfVAesg841r5t_ksNQzXD98yUWni-QVJPeVcIxIlDPfeBHHlot9FK0_N92Ur7Nw93bzrwHmDu8VuGbK0/s1600/c-program-even-odd-number1.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output : Odd Number&quot; border=&quot;0&quot; height=&quot;160&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzJ7PoO5OmsuSNpQQEJNjeykDNw-_EEObHSAYEAK75u8Pcv9kSWmM89P9qFURcfVAesg841r5t_ksNQzXD98yUWni-QVJPeVcIxIlDPfeBHHlot9FK0_N92Ur7Nw93bzrwHmDu8VuGbK0/s400/c-program-even-odd-number1.png&quot; title=&quot;Output : Odd Number&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQnw9wCCADlXveKFtqbKAxWfNzTuy515Q5MWqsiSDYvJCLesnw9JTAbXwA_0vpk0fap7_9ymT4ON9WmKWlT-Fcnf8G2wAqUkZqNcmWc5sjNYj7jRADfw73UR6R0lknHOWGNe9F70lHj5k/s1600/c-program-even-odd-number2.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output : Even Number&quot; border=&quot;0&quot; height=&quot;143&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQnw9wCCADlXveKFtqbKAxWfNzTuy515Q5MWqsiSDYvJCLesnw9JTAbXwA_0vpk0fap7_9ymT4ON9WmKWlT-Fcnf8G2wAqUkZqNcmWc5sjNYj7jRADfw73UR6R0lknHOWGNe9F70lHj5k/s400/c-program-even-odd-number2.png&quot; title=&quot;Output : Even Number&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;Also&amp;nbsp;Check, &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/print-even-and-odd-number-list.html&quot; style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;&lt;b&gt;How to Print Even and Odd Number List&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;C Program To Find Even Or Odd Using Switch Case&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n,r;
 clrscr();

 printf(&quot;\n Enter Any Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 r=n%2;

 switch(r)
 {
  case 0 :
    printf(&quot;\n %d is Even Number&quot;,n);
    break;

  default:
    printf(&quot;\n %d is Odd Number &quot;,n);
 }

 getch();
}
&lt;/pre&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In the above program, We have stored the remainder in the variable &#39;r&#39;and checked whether that is zero or not using the &lt;/span&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cprogramming/switch_statement_in_c.htm&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;switch case&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;. If it is zero the entered number is even, if not the number is odd.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;C Program To Check Even Or Odd Using Conditional Operator&lt;/span&gt;&lt;/h4&gt;
&lt;pre class=&quot;brush:c&quot; style=&quot;text-align: left;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n;
 clrscr();

 printf(&quot;\n Enter Any Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 n%2 == 0 ? printf(&quot;\n %d is Even Number&quot;,n) : printf(&quot;\n %d is Odd Number&quot;,n);

 getch();
}
&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; text-align: left;&quot;&gt;
&lt;h4 style=&quot;margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;C Program To Find Even Or Odd Number Using Function&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
int evenodd(int x);

void main()
{
  int n;
  clrscr();

  printf(&quot;\n Enter Any Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;n);

  evenodd(n);

  getch();
}

evenodd(int x)
{
 if(x%2==0)
   printf(&quot;\n %d is Even Number&quot;,x);

 else
   printf(&quot;\n %d is Odd Number&quot;,x);

 return 0;
}&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;Thus, we can easily find out the given number is even or odd in c programming by various methods.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/even-or-odd-number-if-else-switch-case.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi98AwexvSY7knrcI7uJ6CAAUprR1kfJqeYk9Wkewhxn8ARlcMgn0Ixf7hyphenhyphen1SMJkk9eiJQqCiG5UxA1tDTsl6495J0EXseMNgvsLEQKgAnDHWKsyuOLCUQV_8YVvtBtMQIcfQAos0UZWRs/s72-c/c-program-even-or-odd-number.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-4816579965974829611</guid><pubDate>Fri, 05 Dec 2014 06:56:00 +0000</pubDate><atom:updated>2015-06-18T14:40:37.428+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Conditional Programs</category><title>C Program To Check If A Given Number is Positive Or Negative</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkd0PYZ_EYvAjkDuo7hDTSBDxBGjr2PGbUyGc__D62Mqns935nhSG3XwZ9pufpeEMxGfmNsgY4Ez5RNEac8WoDxHoufUl0Z68CG5oAH8qAATwRyixIYZBnpLZSzZz3A62BqTh47koLFeA/s1600/c-program-positive-negative-number.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
In this c program, we will get any random number&amp;nbsp;from&amp;nbsp;the user and check whether the number is positive or negative. The logic behind this is simple.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;We get a number from the user&amp;nbsp;using&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/11/scanf-function-in-c.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;scanf&amp;nbsp;function in c&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;, check whether the number is greater than 0 or not. If the number turns out to be greater than zero we print the message as this number is positive or else the number is negative.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
To perform this type of program we use conditional statement if...else..&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;The general&amp;nbsp;format of&amp;nbsp;&lt;em style=&quot;background-color: white;&quot;&gt;&lt;u&gt;If..Else...statement&lt;/u&gt;&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;pre&gt;if(condition = true)
&amp;nbsp; {
       // perform this statements
&amp;nbsp;&amp;nbsp;} 
else
{
     &amp;nbsp;//perform this statements
}&lt;/pre&gt;
&lt;div&gt;
&lt;h3 style=&quot;line-height: 1.3em; text-align: left;&quot;&gt;
&lt;/h3&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;font-weight: normal; line-height: 1.3em;&quot;&gt;C program to check the number is&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;line-height: 1.3em;&quot;&gt;positive or negative&lt;/i&gt;&lt;span style=&quot;font-weight: normal; line-height: 1.3em;&quot;&gt;&amp;nbsp;using if..else..statement&lt;/span&gt;&lt;span style=&quot;line-height: 1.3em;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int n;
 clrscr();

 printf(&quot;\n Enter Any Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 if(n&amp;gt;=0)
 {
  if(n==0)
   {
    printf(&quot;\n Number is Zero &quot;);
   }
   else
   {
    printf(&quot;\n %d is Positive &quot;,n);
   }
 }
 else
 {
  printf(&quot;\n %d is Negative &quot;,n);
 }

 getch();
}&lt;/pre&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;more&quot;&gt;&lt;/a&gt;

&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;strong&gt;Output:&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEmu7BVBAfhb5Vn9Bk4xuS9AnzwIdZ3zBjXAzUp4c8YruT6HMHA6QAss7Y3rQv8SmYNLEucMWygMYH-TukQp1heUPV5kf6g4CUSdfngq6Mfr1HslRmN8euJt4DAEw_IKALZo_qufYL4gg/s1600/positive_negative_c_program0.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;positive-negative-c-program-output&quot; border=&quot;0&quot; height=&quot;148&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEmu7BVBAfhb5Vn9Bk4xuS9AnzwIdZ3zBjXAzUp4c8YruT6HMHA6QAss7Y3rQv8SmYNLEucMWygMYH-TukQp1heUPV5kf6g4CUSdfngq6Mfr1HslRmN8euJt4DAEw_IKALZo_qufYL4gg/s1600/positive_negative_c_program0.PNG&quot; title=&quot;positive-negative-c-program-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqe_KZ6PLmbEPrIUApEgvetZN0dtVWvEz2tOj1aK_5Z4hvjmz7NSH3zvC8DfNe8YFVXvjs14rYhLpiiYjt7OCC3x_gJtj4YgNIYCS3VTpp50tOum37U9HmHt7QapczvKoZyzKt6oMcwEs/s1600/positive_negative_c_program1.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;positive-negative-c-program-output&quot; border=&quot;0&quot; height=&quot;160&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqe_KZ6PLmbEPrIUApEgvetZN0dtVWvEz2tOj1aK_5Z4hvjmz7NSH3zvC8DfNe8YFVXvjs14rYhLpiiYjt7OCC3x_gJtj4YgNIYCS3VTpp50tOum37U9HmHt7QapczvKoZyzKt6oMcwEs/s1600/positive_negative_c_program1.PNG&quot; title=&quot;positive-negative-c-program-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdMlI9bdChHMpbwdtW8A-wn2vyekDGMT5xWozXLaizcf957dxI85U_NHkfB4gEP2TGEnyWIkLpGEXPh05ho8QCcpQzJKwlzEmkLe8qrsvuCQCyf5OwKmCLDk8shCr6jhDL0W29KTpzv3s/s1600/positive_negative_c_program2.PNG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;positive-negative-c-program-output&quot; border=&quot;0&quot; height=&quot;148&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdMlI9bdChHMpbwdtW8A-wn2vyekDGMT5xWozXLaizcf957dxI85U_NHkfB4gEP2TGEnyWIkLpGEXPh05ho8QCcpQzJKwlzEmkLe8qrsvuCQCyf5OwKmCLDk8shCr6jhDL0W29KTpzv3s/s1600/positive_negative_c_program2.PNG&quot; title=&quot;positive-negative-c-program-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal; line-height: 1.2em;&quot;&gt;Positive or Negative - C Program for Dev C++&lt;/span&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;/ul&gt;
&lt;/h3&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
int main()
{
 int n;
 
 printf(&quot;\n Enter Any Number : &quot;);
 scanf(&quot;%d&quot;,&amp;amp;n);

 if(n&amp;gt;=0)
 {
  if(n==0)
   {
    printf(&quot;\n Number is Zero &quot;);
   }
   else
   {
    printf(&quot;\n %d is Positive &quot;,n);
   }
 }
 else
 {
  printf(&quot;\n %d is Negative &quot;,n);
 }

 getch();
 return 0;
}

&lt;/pre&gt;
&lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; white-space: normal;&quot;&gt;Output&lt;/strong&gt;&lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; white-space: normal;&quot;&gt;: &lt;/strong&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaTR_uGlecx0-Kpy8UVxZnAXJA6hTi1oBqz4XFRayN2RfjYuX7KYZ7g4P1oz0cwSg-RRf6VLyoey3tjMfLif1-KINVdJLd45vB3a0UL4qmgnJEyS630kRot9nLZixjT5yG3eZ3p1JI3ZY/s1600/positive-negative-c-program-output0.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;positive-negative-c-program-output&quot; border=&quot;0&quot; height=&quot;112&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaTR_uGlecx0-Kpy8UVxZnAXJA6hTi1oBqz4XFRayN2RfjYuX7KYZ7g4P1oz0cwSg-RRf6VLyoey3tjMfLif1-KINVdJLd45vB3a0UL4qmgnJEyS630kRot9nLZixjT5yG3eZ3p1JI3ZY/s1600/positive-negative-c-program-output0.PNG&quot; title=&quot;positive-negative-c-program-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoLIhB9NcZjTNKqE5YYd69xqZvg95NVxa5uFwKbAnWXDMRZav9skugy-MK4L-4g6yA2fU5vHsr9ahZMys3P7gMxWJcz6rbhe3B9-g8LdQWIaWrjHNzABn-a8wBLXtsAYoRYUkxMWTiTgk/s1600/positive-negative-c-program-output1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;positive-negative-c-program-output&quot; border=&quot;0&quot; height=&quot;125&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoLIhB9NcZjTNKqE5YYd69xqZvg95NVxa5uFwKbAnWXDMRZav9skugy-MK4L-4g6yA2fU5vHsr9ahZMys3P7gMxWJcz6rbhe3B9-g8LdQWIaWrjHNzABn-a8wBLXtsAYoRYUkxMWTiTgk/s1600/positive-negative-c-program-output1.PNG&quot; title=&quot;positive-negative-c-program-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0de6G6SiXyQ8AQy26EHDnIGnq93ijUK7rySh5K9x6yGXNvAgfI4CPtrZBrKf217Xyx9UaGGhAOcWhQpOV5f5De0vjOIsvzj2spXRzgw_q6P2YUBNouhIYPGbEdIePcd1Uw5uv723NowI/s1600/positive-negative-c-program-output2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;positive-negative-c-program-output&quot; border=&quot;0&quot; height=&quot;133&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0de6G6SiXyQ8AQy26EHDnIGnq93ijUK7rySh5K9x6yGXNvAgfI4CPtrZBrKf217Xyx9UaGGhAOcWhQpOV5f5De0vjOIsvzj2spXRzgw_q6P2YUBNouhIYPGbEdIePcd1Uw5uv723NowI/s1600/positive-negative-c-program-output2.PNG&quot; title=&quot;positive-negative-c-program-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; white-space: normal;&quot;&gt; &lt;/strong&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; white-space: normal;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In this way, we can perform the program to check whether the given number is positive or negative.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-positive-negative-number.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkd0PYZ_EYvAjkDuo7hDTSBDxBGjr2PGbUyGc__D62Mqns935nhSG3XwZ9pufpeEMxGfmNsgY4Ez5RNEac8WoDxHoufUl0Z68CG5oAH8qAATwRyixIYZBnpLZSzZz3A62BqTh47koLFeA/s72-c/c-program-positive-negative-number.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-5725442314834352642</guid><pubDate>Wed, 03 Dec 2014 15:31:00 +0000</pubDate><atom:updated>2015-07-18T13:08:54.922+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basic Programs</category><title>C Program To Swap Two Numbers Without Using Third Variable</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqgVBZxA3nbMLSZDbPGzuKmixOvNTUM-gcJPYhrml_VmGxjJ448NSkJD5Hlg4n_M8nEd9-p2JhxUkGhWswROTXaDBK_CkBvqcCibw6G8GY_w2P0Artv1i37LyUxvZ17EnC5_HxkjxiJ8E/s1600/c-program-swap-two-numbers-w.jpg.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;We have seen how to &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-swap-two-numbers.html&quot; target=&quot;_blank&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;swap two numbers in c using a third variable&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;i&gt;,&lt;/i&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; now here we will learn the c program to swap two numbers without using a third variable.&lt;/span&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;
&lt;span style=&quot;font-size: large; font-weight: normal;&quot;&gt;Swapping of Two Numbers Without Using Third Variable&lt;/span&gt;&lt;/h2&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int a,b;
 clrscr();

 printf(&quot;\n Type any two numbers to swap:\n &quot;);

 printf(&quot;\n A = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;a);

 printf(&quot;\n B = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;b);

 printf(&quot;\n Numbers before swapping \n&quot;);
 printf(&quot;\n A = %d \t B = %d&quot;,a,b);

 &lt;b&gt;a=a+b;
 b=a-b;
 a=a-b;&lt;/b&gt;

 printf(&quot;\n\n Numbers after swapping\n&quot;);
 printf(&quot;\n A = %d \t B = %d&quot;,a,b);


getch();
}&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Output : &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_mbUk1daAb9woaXp6CMsSv2Y4FQA0h6bL3BeFlsxjZajga53Q1c-1UUIglYtN-eKuMU_jjpx6bflEXjk6QKd0ZSge-GjZZ33kbD9bOuf2AOcEHFd8OJIDAhUl85YY-qniPnDKkLYySvnZ/s1600/swapping_without_wariable.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Swap-Two-Numbers-Without-Third-Variable&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_mbUk1daAb9woaXp6CMsSv2Y4FQA0h6bL3BeFlsxjZajga53Q1c-1UUIglYtN-eKuMU_jjpx6bflEXjk6QKd0ZSge-GjZZ33kbD9bOuf2AOcEHFd8OJIDAhUl85YY-qniPnDKkLYySvnZ/s1600/swapping_without_wariable.jpg&quot; title=&quot;Output-Swap-Two-Numbers-Without-Third-Variable&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;When we used a &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-swap-two-numbers.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;third variable&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; we interchanged the values of variables and swapped the numbers. Here ,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;we have added both the numbers (A and B) and stored the total in one of the variables(A).&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;Then we subtracted both the numbers from the total one by one.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;When you subtract one number (A) from the addition of two numbers (A &amp;amp; B) we get the second number (B).&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;Then we stored the values in appropriate variables to swap the values.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt;
Dev C++ Program to Swap Two Numbers&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
&lt;b&gt;int main()&lt;/b&gt;
{
 int a,b;
 
 printf(&quot;\n Type any two numbers to swap:\n &quot;);

 printf(&quot;\n A = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;a);

 printf(&quot;\n B = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;b);

 printf(&quot;\n Numbers before swapping \n&quot;);
 printf(&quot;\n A = %d \t B = %d&quot;,a,b);

 a=a+b;
 b=a-b;
 a=a-b;

 printf(&quot;\n\n Numbers after swapping\n&quot;);
 printf(&quot;\n A = %d \t B = %d&quot;,a,b);

 getch();
&lt;b&gt;return 0;&lt;/b&gt;
}&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;b&gt;Output :&lt;/b&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbo0l5dygjqDhgCFwVsF-Xwuw_QkSVyBiKeHr0J9jZWbsWnUspsbPfNdE6_9YDn03WmkLb4P86aqhj8xkUJbkzgg6SwDu8t-b42Crp9g1Q-SIjsbeWoYWC_d-zF3Wx5xL1Ru62Tlh2m6I/s1600/c-program-+to-swap-two-numbers-without-third-variable.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Swap-Two-Numbers-Without-Using-Third-Variable&quot; border=&quot;0&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbo0l5dygjqDhgCFwVsF-Xwuw_QkSVyBiKeHr0J9jZWbsWnUspsbPfNdE6_9YDn03WmkLb4P86aqhj8xkUJbkzgg6SwDu8t-b42Crp9g1Q-SIjsbeWoYWC_d-zF3Wx5xL1Ru62Tlh2m6I/s400/c-program-+to-swap-two-numbers-without-third-variable.PNG&quot; title=&quot;Output-Swap-Two-Numbers-Without-Using-Third-Variable&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In this way, we can swap to numbers in c without using a third variable.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/swap-two-numbers-without-third-variable.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqgVBZxA3nbMLSZDbPGzuKmixOvNTUM-gcJPYhrml_VmGxjJ448NSkJD5Hlg4n_M8nEd9-p2JhxUkGhWswROTXaDBK_CkBvqcCibw6G8GY_w2P0Artv1i37LyUxvZ17EnC5_HxkjxiJ8E/s72-c/c-program-swap-two-numbers-w.jpg.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-5046091700697115810</guid><pubDate>Wed, 03 Dec 2014 15:19:00 +0000</pubDate><atom:updated>2015-07-18T13:08:59.672+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basic Programs</category><title>C Program To Swap Two Numbers Using A Third Variable</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGJdltragC1yjWTVxm7f9zD8hcxafqFDgcKJZYZVulaymMoCLFWpfsaj2-Ql9mhD4hS0Ld2fa1EKoAKfhTukPaFJNFqSKrw0xIA8K8lA2a0Z0f-G5QuK95ADorfe_VvKTJV7_lSovdkM0/s1600/c-program-to-swap-two-numbers.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
In this c program, we will get two numbers from the user&amp;nbsp;and swap the values, meaning if A and B are two variables having the values 15 and 25 Respectively. After Swapping the Numbers, the values will change to A = 25 and B = 15.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; line-height: 1.2em;&quot;&gt;Swapping Of Two Numbers In C Using A Third Variable&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-large; line-height: 1.2em;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int a,b,temp;
 clrscr();

 printf(&quot;\n Type any two numbers to swap:\n &quot;);

 printf(&quot;\n A = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;a);

 printf(&quot;\n B = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;b);

 printf(&quot;\n Numbers before swapping \n&quot;);
 printf(&quot;\n A = %d \t B = %d&quot;,a,b);

 &lt;b&gt;temp=a;
 a=b;
 b=temp;&lt;/b&gt;

 printf(&quot;\n\n Numbers after swapping\n&quot;);
 printf(&quot;\n A = %d \t B = %d&quot;,a,b);


getch();
}&lt;/pre&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt; &lt;b&gt;Output :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf96JQcLfmGi-C24QLB8Jg5QFJwT0Vlsqjuevtx1UYbAfQjgn4nuSJCCoyZTtkuKk_EQ0s1PbeWFdeCA0YNf-q7PTHN5v6ddAMzHZvPFXL3a3GmejWFhwcnWaiqb70uR366Vew1PcLcNrl/s1600/swapping_using_variable.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-Swap-Two-Numbers-Using-Third-Variable&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf96JQcLfmGi-C24QLB8Jg5QFJwT0Vlsqjuevtx1UYbAfQjgn4nuSJCCoyZTtkuKk_EQ0s1PbeWFdeCA0YNf-q7PTHN5v6ddAMzHZvPFXL3a3GmejWFhwcnWaiqb70uR366Vew1PcLcNrl/s1600/swapping_using_variable.jpg&quot; title=&quot;Output-Swap-Two-Numbers-Using-Third-Variable&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;How Swapping Works!&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-size: 24px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; font-size: 24px; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuPwyyudTHxo3Fy5JjwT7zS3CLirO_DflqptzzjCeqbs7jxBfxJuK1SRicGVkJRLBQ_o963qozy4vNghBJeOdqCxBiONc7G2l8Ef7UD6arBOIBHhYvLFp07IFjJZGVPZPEIneurw-czpQ/s1600/swap-two-numbers-ex.gif&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Swapping Of Two Numbers&quot; border=&quot;0&quot; height=&quot;225&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuPwyyudTHxo3Fy5JjwT7zS3CLirO_DflqptzzjCeqbs7jxBfxJuK1SRicGVkJRLBQ_o963qozy4vNghBJeOdqCxBiONc7G2l8Ef7UD6arBOIBHhYvLFp07IFjJZGVPZPEIneurw-czpQ/s400/swap-two-numbers-ex.gif&quot; title=&quot;Swapping Of Two Numbers&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 24px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 24px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 24px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 24px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 24px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 24px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 24px;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
(Image source: tutorial4us.com)&lt;/div&gt;
&lt;ul style=&quot;font-size: 24px; text-align: left;&quot;&gt;
&lt;li&gt;We use a temporary variable along with two variables A and B.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The logic behind this is easy. We will interchange the values in-between the variables.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;As the temp variable have no value in it, we&#39;ll first move the value from A into temp variable.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Then We&#39;ll Move the value from B to A and then again the value we stored in temp into B. &lt;br /&gt;This way the values of A and B gets swapped.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt; C Program to Swap Two Numbers in Dev C++&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
&lt;b&gt;int main()&lt;/b&gt;
{
 int a,b,temp;

 printf(&quot;\n Type any two numbers to swap:\n &quot;);

 printf(&quot;\n A = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;a);

 printf(&quot;\n B = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;b);

 printf(&quot;\n Numbers before swapping \n&quot;);
 printf(&quot;\n A = %d \t B = %d&quot;,a,b);

 temp=a;
 a=b;
 b=temp;

 printf(&quot;\n\n Numbers after swapping\n&quot;);
 printf(&quot;\n A = %d \t B = %d&quot;,a,b);


 getch();
&lt;b&gt;return 0;&lt;/b&gt;
}&lt;/pre&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;b&gt;Output :&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSIVcya1nUUOUuCwOpgkx4DD4vLkT16QpbrQsfB-YnmBGxj2y8ManTtfhFrwPbiPsDJEEA28dcvM73hyphenhyphenaugLwRQqaAp_VGFti9voQkJq0cmiLFrjoPxdyz0OGuG5vF_fM1YW3PBxvkCK4/s1600/c-program-+to-swap-two-numbers.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output-C-Program-To-Swap-Two-Numbers&quot; border=&quot;0&quot; height=&quot;215&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSIVcya1nUUOUuCwOpgkx4DD4vLkT16QpbrQsfB-YnmBGxj2y8ManTtfhFrwPbiPsDJEEA28dcvM73hyphenhyphenaugLwRQqaAp_VGFti9voQkJq0cmiLFrjoPxdyz0OGuG5vF_fM1YW3PBxvkCK4/s400/c-program-+to-swap-two-numbers.PNG&quot; title=&quot;Output-C-Program-To-Swap-Two-Numbers&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In this way, you can perform swapping of two numbers in c, you can also do the same program &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-swap-two-numbers-w.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;without using a third variable&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;. &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/swap-two-numbers-using-third-variable.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGJdltragC1yjWTVxm7f9zD8hcxafqFDgcKJZYZVulaymMoCLFWpfsaj2-Ql9mhD4hS0Ld2fa1EKoAKfhTukPaFJNFqSKrw0xIA8K8lA2a0Z0f-G5QuK95ADorfe_VvKTJV7_lSovdkM0/s72-c/c-program-to-swap-two-numbers.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-75723439749467366</guid><pubDate>Wed, 03 Dec 2014 13:29:00 +0000</pubDate><atom:updated>2015-07-01T13:46:07.565+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basic Programs</category><title>C Program To Calculate Area And Circumference Of Circle</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiek7aTGfw0dEC7VGWhySZzY0dW5h7MF5bJb-bAupAdvJKji6nVpd7XeYakl50IgpVu2qZRTWoTyf02t5MBq4UizmLbuxQuTtmKOoPa1a-0flaTiIHIp1yShiHF8Vhh3j-td8tXBKH2fbw/s1600/c-program-to-find-area-and-circumference-of-circle.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
This c program will find out the &lt;i&gt;area and circumference&lt;/i&gt; of a circle by taking the radius of the circle as an input value from the user. We can also perform the program using the function.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-weight: normal; letter-spacing: -1px; line-height: 36px;&quot;&gt;C Program To Find Area And Perimeter Of Circle&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include &amp;lt;conio.h&amp;gt;

#define PI 3.141

void main()
{
 float a,r,c;
 clrscr();

 printf(&quot;\n Enter The Radius : &quot;);
 scanf(&quot;%f&quot;,&amp;amp;r);

 a=PI*r*r; //area of circle formula
 c=2*PI*r; //circumference of circle formula

 printf(&quot;\n Area of circle = %0.2f units/sq&quot;,a);
 printf(&quot;\n\n Circumference Of circle = %0.2f units&quot;,c);

 getch();
}&lt;/pre&gt;
&lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/strong&gt; &lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;Output :&lt;/strong&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc1gIbUvpih7_-ot5syRq9Ce6QjKo7jxnDcSrlNBTf4VjIBsFzC2ctLUQibXcGJn3A97tLweNsUar4xtd1oxd4X9jh-By4r0FdN8IfTY7Bm7BWbAhWD7F6RQBXzNURezna-RnRb0j5xFU/s1600/c-program-find-area-and-circumference-of-circle.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Output : Area And Circumference Of Circle&quot; border=&quot;0&quot; height=&quot;153&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc1gIbUvpih7_-ot5syRq9Ce6QjKo7jxnDcSrlNBTf4VjIBsFzC2ctLUQibXcGJn3A97tLweNsUar4xtd1oxd4X9jh-By4r0FdN8IfTY7Bm7BWbAhWD7F6RQBXzNURezna-RnRb0j5xFU/s400/c-program-find-area-and-circumference-of-circle.PNG&quot; title=&quot;Output : Area And Circumference Of Circle&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;In the above program, we have used the following formulas.&lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;u&gt;&lt;a href=&quot;https://www.google.co.in/search?q=c+program+to+calculate+area+and+circumference+of+circle+using+function&amp;amp;num=50&amp;amp;as_qdr=all&amp;amp;safe=off&amp;amp;pws=0&amp;amp;gws_rd=cr,ssl&amp;amp;ei=7JmTVbrVEcOMuASWrYOoDg#num=50&amp;amp;safe=off&amp;amp;as_qdr=all&amp;amp;pws=0&amp;amp;q=area+of+circle&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;Area Of Circle&lt;/span&gt;&lt;/a&gt;&lt;/u&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; &amp;nbsp; A= π * r * r&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;u&gt;&lt;a href=&quot;https://www.google.co.in/search?q=c+program+to+calculate+area+and+circumference+of+circle+using+function&amp;amp;num=50&amp;amp;as_qdr=all&amp;amp;safe=off&amp;amp;pws=0&amp;amp;gws_rd=cr,ssl&amp;amp;ei=7JmTVbrVEcOMuASWrYOoDg#num=50&amp;amp;safe=off&amp;amp;as_qdr=all&amp;amp;pws=0&amp;amp;q=circumference+of+circle&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;Circumference Of Circle&lt;/span&gt;&lt;/a&gt;&lt;/u&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; &amp;nbsp; C = 2 *&amp;nbsp;π * r&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&amp;nbsp;(Here PI(π) is constant and is&amp;nbsp;equal to 3.141.)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: x-large; letter-spacing: -1px; line-height: 36px;&quot;&gt;C Program To Calculate Area And Circumference Of Circle Using Function&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: x-large; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include &amp;lt;conio.h&amp;gt;

#define PI 3.141

float area(float n);
float peri(float m);

void main()
{
 float a,r,c;
 clrscr();

 printf(&quot;\n Enter The Radius : &quot;);
 scanf(&quot;%f&quot;,&amp;amp;r);
 
 a=area(r); //area of circle formula
 c=peri(r); //circumference of circle formula

 printf(&quot;\n Area of circle = %0.2f units/sq&quot;,a);
 printf(&quot;\n\n Circumference Of circle = %0.2f units&quot;,c);

 getch();
}

float area(float n)
{
  return(PI*n*n);
}

float peri(float m)
{
 return(2*PI*m);
}&lt;/pre&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; white-space: normal;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In this way, we can find the &lt;/span&gt;&lt;a href=&quot;http://math.about.com/od/formulas/ss/areaperimeter.htm#step5&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;area and perimeter of a circle&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; using this simple method in c programming.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-find-area-circumference-circle.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiek7aTGfw0dEC7VGWhySZzY0dW5h7MF5bJb-bAupAdvJKji6nVpd7XeYakl50IgpVu2qZRTWoTyf02t5MBq4UizmLbuxQuTtmKOoPa1a-0flaTiIHIp1yShiHF8Vhh3j-td8tXBKH2fbw/s72-c/c-program-to-find-area-and-circumference-of-circle.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-118019975319918844</guid><pubDate>Wed, 03 Dec 2014 13:07:00 +0000</pubDate><atom:updated>2015-06-20T22:34:37.930+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basic Programs</category><category domain="http://www.blogger.com/atom/ns#">Conditional Programs</category><title>C Program To Find The Total And Average Of The Marks</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhewJRfALoWGu1zsi8jFR5tXDBchqfwGOa8CJDhI21fpIzlxTmkaq7t8kSP9atgJcM3dDjUfDZOsidJ8mVL0305BlAjxnGd-otCwhBJM0n6yWN5bTPhwtENrLqqlxHprh28lNKBX2O_-Bk/s1600/c-program-calculate-total-marks-and-average.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
We will write a program to get marks of five subject from the user and according to that &lt;i&gt;calculate the total marks&lt;/i&gt; obtained as well as the percentage.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;font-size: x-large; line-height: 1.3em;&quot;&gt;C Program to Calculate Total Marks and Average&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int s1,s2,s3,s4,s5,t;
 float p;
 clrscr();

 printf(&quot;\n Enter marks of 5 subjects each out of 100 &quot;);
 printf(&quot;\n\n ********************************************&quot;);

 printf(&quot;\n\n Maths = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;s1);

 printf(&quot;\n Science = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;s2);

 printf(&quot;\n English = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;s3);

 printf(&quot;\n History = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;s4);

 printf(&quot;\n Geography = &quot;);
 scanf(&quot;%d&quot;,&amp;amp;s5);
 printf(&quot;\n ********************************************&quot;);

 t=s1+s2+s3+s4+s5;  //Total
 printf(&quot;\n Total marks = %d/500&quot;,t);

 p=t/5;  //Percentage
 printf(&quot;\n\n Percentage = %.2f&quot;,p);
 printf(&quot;\n ********************************************&quot;);

 getch();
}&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;b&gt;Output:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGEtixcdI4uiZqMo_avv8pzAFoLan17zO-MsBDxtGVpgY_rlPu5gDtPt2a2Onu5RS0cpfjgvAlqKyjteG9D3xOJDbVrSV0cBaRDLFk2lBq5AbMwsnPaXAsZr6_RFaUZt2TTWgSnMHkoyU/s1600/c-program-find-total-marks-and-average-output.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-find-total-marks-and-average-output&quot; border=&quot;0&quot; height=&quot;347&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGEtixcdI4uiZqMo_avv8pzAFoLan17zO-MsBDxtGVpgY_rlPu5gDtPt2a2Onu5RS0cpfjgvAlqKyjteG9D3xOJDbVrSV0cBaRDLFk2lBq5AbMwsnPaXAsZr6_RFaUZt2TTWgSnMHkoyU/s400/c-program-find-total-marks-and-average-output.PNG&quot; title=&quot;c-program-find-total-marks-and-average-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Further, we can extend this program and &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-find-grades-if-ladder-and-switch.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;give grades according to the marks obtained&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;, also we can write the same program using the function.&lt;/span&gt;&lt;/div&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program To Find Total Marks And Percentage Using Function&amp;nbsp;&lt;/span&gt;&lt;/h4&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;

 int total();
 int percentage();
 int sum;

 void main()
  {
   int t;
   float p;
   clrscr();

   t=total();
   printf(&quot;\n Total marks = %d/500&quot;,t);

   p=percentage();  //Percentage
   printf(&quot;\n\n Percentage = %.2f&quot;,p);
   printf(&quot;\n ********************************************&quot;);

   getch();
  }

 int total()
 {
   int s1,s2,s3,s4,s5;

   printf(&quot;\n Enter marks of 5 subjects each out of 100 &quot;);
   printf(&quot;\n\n ********************************************&quot;);

   printf(&quot;\n\n Maths = &quot;);
   scanf(&quot;%d&quot;,&amp;amp;s1);

   printf(&quot;\n Science = &quot;);
   scanf(&quot;%d&quot;,&amp;amp;s2);

   printf(&quot;\n English = &quot;);
   scanf(&quot;%d&quot;,&amp;amp;s3);

   printf(&quot;\n History = &quot;);
   scanf(&quot;%d&quot;,&amp;amp;s4);

   printf(&quot;\n Geography = &quot;);
   scanf(&quot;%d&quot;,&amp;amp;s5);
   printf(&quot;\n ********************************************&quot;);

 sum=s1+s2+s3+s4+s5;  //Total

 return(sum);
}

int percentage()
{
 return(sum/5);
}&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
This way we can write a c program to calculate total marks and percentage.&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-find-total-marks-and-average.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhewJRfALoWGu1zsi8jFR5tXDBchqfwGOa8CJDhI21fpIzlxTmkaq7t8kSP9atgJcM3dDjUfDZOsidJ8mVL0305BlAjxnGd-otCwhBJM0n6yWN5bTPhwtENrLqqlxHprh28lNKBX2O_-Bk/s72-c/c-program-calculate-total-marks-and-average.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-3445333341492904673</guid><pubDate>Wed, 03 Dec 2014 09:41:00 +0000</pubDate><atom:updated>2015-07-18T20:05:08.807+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basic Programs</category><category domain="http://www.blogger.com/atom/ns#">Pointer Programs</category><title>C Program To Add Two Numbers Using Functions/Pointer</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-program-to-add-two-numbers&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5ERrkN_7NQC-ufgp9cm8RQkBFG1Hikw36lq5AOARBBsFWDgawTSEeHsz1EXYfH91oYdNzqSUNg6n1wf3EeqLgV3ncsES1pfjASeLwoXK1vKSUV7qS01yak75HgeHaWIKFrFLBceYTMAE/s1600/c-program-to-add-numbers.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-program-to-add-two-numbers&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
In This c program, we are going to add two numbers, for example if we get two numbers 4 and 5 the program will output the result as 9 which equals to 4+5.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;As said in the &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;previous tutorial&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt; instead of declaring the values of the variables inside the program we will get the values by the user using&amp;nbsp;&lt;/span&gt;&lt;i&gt;scanf&lt;/i&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;i&gt;&amp;nbsp;function in c&lt;/i&gt; to make the program&amp;nbsp;&lt;/span&gt;general&lt;span style=&quot;color: #0d0d0d;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;i&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Read : &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/11/scanf-function-in-c.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;How to use Scanf function in c program&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em;&quot;&gt;
&lt;span style=&quot;font-size: x-large; font-weight: normal;&quot;&gt; C Program To Add Two Numbers Using Addition Operator&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
int a,b,add;
clrscr();

printf(&quot;\n Enter Any Two Numbers To Add : &quot;);
scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b);

add=a+b;

printf(&quot;\n Addition = %d&quot;,add);

getch();
}&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Output :&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMBhi7Slv2hi79jilQJC54g0K61VOIA8-8XbptDBo4sKxbdTRR0bpiQGQH9LAKekEEmaUz5K3rxnLeZYhp5WJPyXai28LZKTawbuU29C0xC3Xg4a3GosyjbCVh-_Wb66O-jylkCuqlDHe_/s1600/addition.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-to-add-two-numbers-output&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMBhi7Slv2hi79jilQJC54g0K61VOIA8-8XbptDBo4sKxbdTRR0bpiQGQH9LAKekEEmaUz5K3rxnLeZYhp5WJPyXai28LZKTawbuU29C0xC3Xg4a3GosyjbCVh-_Wb66O-jylkCuqlDHe_/s1600/addition.jpg&quot; title=&quot;c-program-to-add-two-numbers-output&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Watch the video below&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;&amp;nbsp;For Better Understanding of this program.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;youtube-container&quot;&gt;
&lt;div class=&quot;youtube-player&quot; data-id=&quot;l-kNt5BrZTI&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;style&gt;
.youtube-container { display: block; margin: 20px auto; width: 100%; max-width: 600px; }
.youtube-player { display: block; width: 100%; /* assuming that the video has a 16:9 ratio */ 

padding-bottom: 56.25%; overflow: hidden; position: relative; width: 100%; height: 100%; cursor: 

hand; cursor: pointer; display: block; }
img.youtube-thumb { bottom: 0; display: block; left: 0; margin: auto; max-width: 100%; width: 

100%; position: absolute; right: 0; top: 0; height: auto }
div.play-button { height: 72px; width: 72px; left: 50%; top: 50%; margin-left: -36px; margin-top: 

-36px; position: absolute; background: url(&quot;http://i.imgur.com/TxzC70f.png&quot;) no-repeat; }
#youtube-iframe { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
&lt;/style&gt;

&lt;/div&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt; C Program For Dev C++ to Add Two Numbers&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
 main()
{
 int a,b,add;
  
 printf(&quot;\n Enter Any Two Numbers To Add : &quot;);
 scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b); // get the values by user

 add=a+b; // addtion is performed and stored in &quot;add&quot;

 printf(&quot;\n Addition = %d&quot;,add); // display output

 getch();
 return 0;
 
}&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;strong style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;Output :&lt;/strong&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFZtaD4HFF_xe6_TEjlH8ejT63-_adttDNnYuRdBaKkHT_h3PT0D9lJJpOMy7fwWW-rqNmgr4Xu7Mg3HoXtvUkNE7FHbqZhoMnSjw7S35F7KSGKEFbIgH9mNdIKso-0wXxrafdKUY-OYU/s1600/c-program-add-two-numbers-output.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-to-add-two-numbers-output&quot; border=&quot;0&quot; height=&quot;132&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFZtaD4HFF_xe6_TEjlH8ejT63-_adttDNnYuRdBaKkHT_h3PT0D9lJJpOMy7fwWW-rqNmgr4Xu7Mg3HoXtvUkNE7FHbqZhoMnSjw7S35F7KSGKEFbIgH9mNdIKso-0wXxrafdKUY-OYU/s1600/c-program-add-two-numbers-output.PNG&quot; title=&quot;c-program-to-add-two-numbers-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 24px; letter-spacing: -1px; line-height: 36px;&quot;&gt;We can Also Perform the &lt;i&gt;&lt;b&gt;addition of two numbers using functions&lt;/b&gt;&lt;/i&gt; in C for that we will create a function named as &#39;add&#39;(it is not&amp;nbsp;necessary to name it as add you can call it whatever you like) define the function appropriately and call it from the main function as shown below :&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt; C program to add two numbers using function:&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
int add(int a,int b); //function declaration

void main()
{
 int sum,x,y;
 clrscr();

 printf(&quot;\n Enter Any Two Numbers To Add : &quot;);
 scanf(&quot;%d%d&quot;,&amp;amp;x,&amp;amp;y);

 sum=add(x,y); //calling the function

 printf(&quot;\n Addition = %d&quot;,sum);

 getch();

 }

 int add(int a, int b)  //definition of function
 {
  int c;

  c=a+b;

  return(c);
 }&lt;/pre&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; white-space: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; white-space: normal;&quot;&gt;We can also use pointers to perform this addition in C&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; white-space: normal;&quot;&gt;like below :&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt; Add two numbers using pointers in C&lt;/span&gt;&lt;span style=&quot;font-size: 1.2em;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h4&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int *p1,*p2,a,b,add;
 clrscr();

 printf(&quot;\n Enter Any Two Numbers To Add : &quot;);
 scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b);

 p1=&amp;amp;a;
 p2=&amp;amp;b;

 add= *p1 + *p2;

 printf(&quot;\n Addition = %d&quot;,add);

 getch();

}&lt;/pre&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; white-space: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; white-space: normal;&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;In this &lt;/span&gt;way,&lt;span style=&quot;color: #0d0d0d;&quot;&gt; we can add two numbers in C using functions and pointers.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-add-two-numbers.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5ERrkN_7NQC-ufgp9cm8RQkBFG1Hikw36lq5AOARBBsFWDgawTSEeHsz1EXYfH91oYdNzqSUNg6n1wf3EeqLgV3ncsES1pfjASeLwoXK1vKSUV7qS01yak75HgeHaWIKFrFLBceYTMAE/s72-c/c-program-to-add-numbers.jpg" height="72" width="72"/><georss:featurename>India</georss:featurename><georss:point>20.593684 78.962880000000041</georss:point><georss:box>-8.5806465 37.654286000000042 49.7680145 120.27147400000004</georss:box></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-848411788417076173</guid><pubDate>Wed, 03 Dec 2014 09:40:00 +0000</pubDate><atom:updated>2015-06-18T14:47:01.699+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basic Programs</category><category domain="http://www.blogger.com/atom/ns#">Pointer Programs</category><title>C Program To Subtract Two Integers Using Function/Pointer</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSL3zlrnx4iLupp2EA8VB4Ov8aE8YHMYYDbK6na2nfI7qIc1mS6LJu4CAzaVfoQEIvEBF0kvw0wO3wSlOcZHNuCt3y3ItHJ1zPtv3svs-Ey0rNde9g3GxEFDd8S2Q64Epx-Ic6DV45pMg/s1600/c-program-to-subtract-two-numbers.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
In this c&amp;nbsp;program we are going to subtract&amp;nbsp;any two given integers using functions and pointers&amp;nbsp;and display the output.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt; C program to subtract any two integers&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 1.3em;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
int a,b,sub;
clrscr();

printf(&quot;\n Enter Any Two Numbers To Subtract : &quot;);
scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b);

sub=a-b;

printf(&quot;\n Subtraction = %d&quot;,sub);

getch();
}&lt;/pre&gt;
&lt;b&gt;&lt;i&gt;Output :&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_XMyInk89fAEUmQnoL_5RrZM7GntQdvgd_p7ajm4YOiyhf_BXRKD-MS8TZ7_NJVFQ4Ri4GHAVzJdx5Jq26zANtL2Spt2lFlOqSiqTeW0zVDGA9qGOGmNd7VIuKrBdAs6Owu2KwcvsBNUR/s1600/subtraction.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-to-subtract-two-numbers-output&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_XMyInk89fAEUmQnoL_5RrZM7GntQdvgd_p7ajm4YOiyhf_BXRKD-MS8TZ7_NJVFQ4Ri4GHAVzJdx5Jq26zANtL2Spt2lFlOqSiqTeW0zVDGA9qGOGmNd7VIuKrBdAs6Owu2KwcvsBNUR/s1600/subtraction.jpg&quot; title=&quot;c-program-to-subtract-two-numbers-output&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h2 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 1.3em; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;
&lt;/h2&gt;
&lt;h2 style=&quot;font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;
&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: large; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #0d0d0d;&quot;&gt;Also Check : &lt;/span&gt;&lt;a href=&quot;http://cprogramsbasics.blogspot.com/2014/12/c-program-add-two-numbers.html&quot; target=&quot;_blank&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;C Program To Add Any Two Numbers&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/h2&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0d0d0d; font-size: x-large; font-weight: normal;&quot;&gt;C program for Dev C++ to subtract two integers&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;

int main()
{
int a,b,sub;

printf(&quot;\n Enter Any Two Numbers To Subtract : &quot;);
scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b);

sub=a-b;

printf(&quot;\n Subtraction = %d&quot;,sub);

getch();
return 0;
} &lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;i&gt;Output :&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfE0cob18JBkMT4OCuSvLl_pxKzYjXXX2-kox2z0t_U7tdXzqyDwF27A8ivdWYPhezvSWuf6MxS-8Z6pJF9IxC2F7nfUQf8qWH8iBHzlorBHZv6xCP_MHgYLtJB5he0GUqwPycn6B0JjA/s1600/c-program-subtract-two-numbers.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;c-program-to-subtract-two-numbers-output&quot; border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfE0cob18JBkMT4OCuSvLl_pxKzYjXXX2-kox2z0t_U7tdXzqyDwF27A8ivdWYPhezvSWuf6MxS-8Z6pJF9IxC2F7nfUQf8qWH8iBHzlorBHZv6xCP_MHgYLtJB5he0GUqwPycn6B0JjA/s400/c-program-subtract-two-numbers.PNG&quot; title=&quot;c-program-to-subtract-two-numbers-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt; Subtract any two numbers using functions in c&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
int sub(int a,int b); //function declaration

void main()
{
 int result,x,y;
 clrscr();

 printf(&quot;\n Enter Any Two Numbers To Subtract : &quot;);
 scanf(&quot;%d%d&quot;,&amp;amp;x,&amp;amp;y);

 result=sub(x,y); //calling the function

 printf(&quot;\n Subtraction = %d&quot;,result);

 getch();

 }

 int sub(int a, int b)  //definition of function
 {
  int c;

  c=a-b;

  return(c);
 }&lt;/pre&gt;
&lt;/div&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt; C program to subtract any two given numbers using pointers&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int *p1,*p2,a,b,sub;
 clrscr();

 printf(&quot;\n Enter Any Two Numbers To Subtract : &quot;);
 scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b);

 p1=&amp;amp;a;
 p2=&amp;amp;b;

 sub = *p1 - *p2;

 printf(&quot;\n Subtraction = %d&quot;,sub);

 getch();

}&lt;/pre&gt;
&lt;div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
In this way we can subtract two numbers in c programming.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-subtract-two-numbers.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSL3zlrnx4iLupp2EA8VB4Ov8aE8YHMYYDbK6na2nfI7qIc1mS6LJu4CAzaVfoQEIvEBF0kvw0wO3wSlOcZHNuCt3y3ItHJ1zPtv3svs-Ey0rNde9g3GxEFDd8S2Q64Epx-Ic6DV45pMg/s72-c/c-program-to-subtract-two-numbers.jpg" height="72" width="72"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8377073689381508822.post-4165688653187813696</guid><pubDate>Wed, 03 Dec 2014 07:29:00 +0000</pubDate><atom:updated>2015-06-19T11:04:41.179+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basic Programs</category><title>C Program To Calculate Square And Cube Of Given Number</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;img alt=&quot;c-programs-basics&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZApimj0pQUmw_iFcxx-doRk4wlEEU7Ki2z7kkinw05ENAownLbHhWQpfAElXTdBTOSZGYMjjYP1Rzk43T2bYI0TMBPbRC2V9lT9lP8ecxrHuD9hu2Hc0JP2pFulIxoszHgItyewLhUs8/s1600/c-program-square-cube.jpg&quot; style=&quot;display: none;&quot; title=&quot;c-programs-basics&quot; /&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 2px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
Write a c program to find out the square and cube of any given&amp;nbsp;number?&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
This c program will calculate the square and cube of any given number. We will also perform this by the use of functions.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h2 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.3em;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program To Find Square and Cube Of A Number&lt;/span&gt;&lt;/h2&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void main()
{
 int a,s,c;
 clrscr();

 printf(&quot;\n Enter A Number: &quot;);
 scanf(&quot;%d&quot;,&amp;amp;a);

 s=a*a;  //Square = number * number
 c=s*a;  //Cube = Square * number

 printf(&quot;\n Square of %d is = %d&quot;,a,s);

 printf(&quot;\n\n Cube of %d is = %d&quot;,a,c);

 getch();
}&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Output :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKQDgaMBa_bA6wQos2swteE0pKijZWpP0rq5VVafZJYun00fVxTIYfIrVgQ0U2D0jv9gLvep1is8HucMYaXgZRc6GU_5CugHw_yVxdBEhzWL4XGBsspStreL_6L4OwSGr8Bi6X35QcKos/s1600/c-program-square-cube-of-number-output.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-square-cube-of-number-output&quot; border=&quot;0&quot; height=&quot;166&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKQDgaMBa_bA6wQos2swteE0pKijZWpP0rq5VVafZJYun00fVxTIYfIrVgQ0U2D0jv9gLvep1is8HucMYaXgZRc6GU_5CugHw_yVxdBEhzWL4XGBsspStreL_6L4OwSGr8Bi6X35QcKos/s400/c-program-square-cube-of-number-output.PNG&quot; title=&quot;c-program-square-cube-of-number-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 1.2em;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;C Program To Determine Square and Cube of Number Using Function&lt;/span&gt;&lt;/h3&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;

int square(int m);
int cube(int n);

void main()
{
  int x,s,c;
  clrscr();

  printf(&quot;\n Enter Any Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;x);

  s=square(x);
  c=cube(x);

  printf(&quot;\n Square of %d is = %d&quot;,x,s);

  printf(&quot;\n\n Cube of %d is = %d&quot;,x,c);

  getch();
}

 int square(int m)
 {
  return(m*m);
 }

 int cube(int n)
 {
   return(n*n*n);
 }&lt;/pre&gt;
&lt;h4 style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;Dev C++ Code to Find the Square and Cube using Function&lt;/span&gt;&lt;/h4&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include&amp;lt;stdio.h&amp;gt;

int square(int m);
int cube(int n);

void main()
{
  int x,s,c;

  printf(&quot;\n Enter Any Number : &quot;);
  scanf(&quot;%d&quot;,&amp;amp;x);

  s=square(x);
  c=cube(x);

  printf(&quot;\n Square of %d is = %d&quot;,x,s);

  printf(&quot;\n\n Cube of %d is = %d&quot;,x,c);

  getch();
}

 int square(int m)
 {
  return(m*m);
 }

 int cube(int n)
 {
   return(n*n*n);
 }&lt;/pre&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;b&gt;Output :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5j1uD4PUEOC-ewy10LTzAga_QOcKZrpgX2GhlPpLUvlbC-132W7sqp1t7mKfvEdH2-R7lVDU8YsoqrSfyc8jb8dGEtpRXMduavpgLgPJ_WNHUxlL-7OMAVg1DxesreJaU1JAB2Nbd0UI/s1600/c-program-square-cube-number-output.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;c-program-square-cube-of-number-output&quot; border=&quot;0&quot; height=&quot;138&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5j1uD4PUEOC-ewy10LTzAga_QOcKZrpgX2GhlPpLUvlbC-132W7sqp1t7mKfvEdH2-R7lVDU8YsoqrSfyc8jb8dGEtpRXMduavpgLgPJ_WNHUxlL-7OMAVg1DxesreJaU1JAB2Nbd0UI/s400/c-program-square-cube-number-output.PNG&quot; title=&quot;c-program-square-cube-of-number-output&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0d0d0d; font-family: Merriweather, Georgia, &#39;Times New Roman&#39;, serif; font-size: 24px; letter-spacing: -1px; line-height: 36px; margin-bottom: 1.1em; margin-top: 1.1em;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://cprogramsbasics.blogspot.com/2014/12/c-program-square-cube-number.html</link><author>noreply@blogger.com (Bhushan hadkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZApimj0pQUmw_iFcxx-doRk4wlEEU7Ki2z7kkinw05ENAownLbHhWQpfAElXTdBTOSZGYMjjYP1Rzk43T2bYI0TMBPbRC2V9lT9lP8ecxrHuD9hu2Hc0JP2pFulIxoszHgItyewLhUs8/s72-c/c-program-square-cube.jpg" height="72" width="72"/></item></channel></rss>