<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='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'><id>tag:blogger.com,1999:blog-3310357430363067015</id><updated>2024-10-24T02:37:54.302-07:00</updated><title type='text'>csamplecode</title><subtitle type='html'>This site is designed in a such way that every person can learn the c language by giving concepts on the c Language with some example programs. In this site we can learn these concepts like Control Structures, Pointers, Arrays and Functions.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://csamplecode.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://csamplecode.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Santosh Kiran</name><uri>http://www.blogger.com/profile/16147687167871737378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3310357430363067015.post-8073989090071119158</id><published>2012-06-10T08:38:00.002-07:00</published><updated>2012-06-07T02:25:20.221-07:00</updated><title type='text'>C Language</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
Welcome to the &lt;a href=&quot;http://csamplecode.blogspot.in/&quot;&gt;csamplecode.in &lt;/a&gt;. The main motive of this site is used to learn the C language easily in this site we discuss about the total c language concepts like variables, control structures, Arrays, Strings, Functions, Pointers, Structures and Files concepts in addition we our guiding with sample programs.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
C Language was developed by Dennis Ritchie in 1972 at bell labs in U.S.A.and it is a Middle Level Language.&lt;br /&gt;
&lt;br /&gt;
C History:Algol is the ancient and traditional language to all the languages it is in binary format. From this language BCPL was developed by Ken Thomson. BCPL was High level language and it is not solved some problems at that time. From BCPL another language was dervied and named it as B by Martin Richards in 1969 at cambridge university. From these two languages one more language was dervied and it is named as &quot;C&quot; by Dennis Ritchie.&lt;br /&gt;
&lt;br /&gt;
C Features: Simple: &amp;nbsp;C is a simple language because it has 32 keywords. Keyword is a reserve word which is taken from english dictionary and given a syntax for that word.&lt;br /&gt;
&lt;br /&gt;
Procedure Oriented Programming Language: C is a Procedure Oriented Programming Languages causes code re usability.&lt;br /&gt;
&lt;br /&gt;
Modularity: Modularity means breaking the project into sub modules, After developing the sub modules and again it is rejoined. C supports Modularity.&lt;br /&gt;
&lt;br /&gt;
Fast Complier: C complier complies the program every fast than the other compliers becuase it is a middle level language.&lt;br /&gt;
&lt;br /&gt;
System Indepedent : C creates system independent language becuase it is a middle level language.&lt;br /&gt;
&lt;br /&gt;
Pointers: Pointers are special variable used to store the other variable address. Pointers are used to allocate dynamic memory allocation in the program.&lt;br /&gt;
&lt;br /&gt;
Functions: c is a Procedure oriented programming language and we can define our own user defined functions.&lt;br /&gt;
&lt;br /&gt;
C Characteristics: 1. C is a Strictly case senstive language&lt;br /&gt;
&lt;br /&gt;
2. Every Program should start with main function.&lt;br /&gt;
&lt;br /&gt;
3. Every Statement should end with semi-colon(;) called as line terminator.&lt;br /&gt;
&lt;br /&gt;
4. Every block open with a { and end with } called as Delimiters.&lt;br /&gt;
&lt;br /&gt;
5. Every function end with () called as&amp;nbsp;parenthesis&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Identifiers&lt;/h3&gt;Identifiers&amp;nbsp;are defined by the programmer to identify the user defined function, variables, structures names etc.&lt;br /&gt;
to specify the names for the identifiers we must follow some rules and regulations these rules are called as identifiers rules and&amp;nbsp;regulations.&lt;br /&gt;
Rule1: Identifier name may any length of long but at least one minimum character should be mentioned.&lt;br /&gt;
Rule 2: Identifier name &amp;nbsp;may be alphanumeric means identifier name can have numbers and alphabets but identifiers should not start with numbers and it can end with numbers.&lt;br /&gt;
Rule 3: Identifier name should not match with keyword.&lt;br /&gt;
Rule 4:&amp;nbsp;Identifier name should not contain spaces in between the words if the identifier is more than one token it can&amp;nbsp;separated&amp;nbsp;by underscore( _ ).&lt;br /&gt;
Rule 5: Identifier name should not contain special&amp;nbsp;characters.&lt;br /&gt;
Rule 6: identifier name may be upper case/ lower case once we define the name with that name only we must access other wise it show the error.&lt;br /&gt;
Example for Valid Identifiers :&lt;br /&gt;
&lt;ul type=&quot;circle&quot;&gt;&lt;li&gt; Student_Name&lt;/li&gt;
&lt;li&gt;firstnumber&lt;/li&gt;
&lt;li&gt;m1&lt;/li&gt;
&lt;/ul&gt;Example for Invalid Identifiers:&lt;br /&gt;
&lt;ul type=&quot;circle&quot;&gt;&lt;li&gt;S.No&lt;/li&gt;
&lt;li&gt;student name&lt;/li&gt;
&lt;li&gt;int&lt;/li&gt;
&lt;/ul&gt;Variables: It is used to allocate a block memory for the programmer to store the data. To identify the block of memory we must specify name, and it should follow identifiers rules and regulations.&lt;br /&gt;
&lt;br /&gt;
Data types: We Use data types for two reasons&lt;br /&gt;
1. what type of data variable is storing to&amp;nbsp;perform&amp;nbsp;the operations.&lt;br /&gt;
2. How much memory should allocate for the variable.&lt;br /&gt;
&lt;br /&gt;
Data type are classified into these types&lt;br /&gt;
&lt;ul type=&quot;Square&quot;&gt;&lt;li&gt;Predefined datatypes&lt;/li&gt;
&lt;ul type=&quot;circle&quot;&gt;&lt;li&gt; Numeric Datatypes&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;int &lt;/li&gt;
&lt;li&gt;float &lt;/li&gt;
&lt;li&gt;double&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt; Non Numeric datatypes&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;char&lt;/li&gt;
&lt;li&gt;string&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;User Defined datatypes&lt;/li&gt;
&lt;ul type=&quot;circle&quot;&gt;&lt;li&gt; Structures&lt;/li&gt;
&lt;li&gt; Unions&lt;/li&gt;
&lt;li&gt; Enums&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;h3&gt;Keywords&lt;/h3&gt;Keyword is a reserve word taken form English dictionary and given a syntax for us. These word should be in lower case. We have 32 keywords in C Language and it became simple for us.&lt;br /&gt;
Keyword list : &lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;auto&lt;/td&gt; &lt;td&gt;break&lt;/td&gt; &lt;td&gt;case&lt;/td&gt; &lt;td&gt;char&lt;/td&gt; &lt;td&gt;const&lt;/td&gt; &lt;td&gt;continue&lt;/td&gt; &lt;td&gt;default&lt;/td&gt; &lt;td&gt;do&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;double&lt;/td&gt; &lt;td&gt;else&lt;/td&gt; &lt;td&gt;enum&lt;/td&gt; &lt;td&gt;extern&lt;/td&gt; &lt;td&gt;float&lt;/td&gt; &lt;td&gt;for&lt;/td&gt; &lt;td&gt;goto&lt;/td&gt; &lt;td&gt;if&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;int&lt;/td&gt; &lt;td&gt;long&lt;/td&gt; &lt;td&gt;register&lt;/td&gt; &lt;td&gt;return&lt;/td&gt; &lt;td&gt;short&lt;/td&gt; &lt;td&gt;signed&lt;/td&gt; &lt;td&gt;sizeof&lt;/td&gt; &lt;td&gt;static&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;struct&lt;/td&gt; &lt;td&gt;switch&lt;/td&gt; &lt;td&gt;typedef&lt;/td&gt; &lt;td&gt;union&lt;/td&gt; &lt;td&gt;unsigned&lt;/td&gt; &lt;td&gt;void&lt;/td&gt; &lt;td&gt;volatile&lt;/td&gt; &lt;td&gt;&lt;br /&gt;
while&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;a href=&quot;http://csamplecode.blogspot.in/2012/05/program-in-c-langauge.html&quot;&gt;first program in C Language&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csamplecode.blogspot.com/feeds/8073989090071119158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://csamplecode.blogspot.com/2012/05/c-language.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/8073989090071119158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/8073989090071119158'/><link rel='alternate' type='text/html' href='http://csamplecode.blogspot.com/2012/05/c-language.html' title='C Language'/><author><name>Santosh Kiran</name><uri>http://www.blogger.com/profile/16147687167871737378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>India</georss:featurename><georss:point>20.593684 78.962880000000041</georss:point><georss:box>6.213675 64.346295500000039 34.973693 93.579464500000043</georss:box></entry><entry><id>tag:blogger.com,1999:blog-3310357430363067015.post-7176846935052057302</id><published>2012-06-09T07:49:00.001-07:00</published><updated>2012-06-07T02:27:41.536-07:00</updated><title type='text'>Program in C Langauge</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When we write a program we should follow some rules and regulations.&lt;br /&gt;
Rule 1: Every program should start with main().&lt;br /&gt;
Rule 2: Variables can&#39;t define the everywhere in the program, in the starting only we must define&amp;nbsp;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 18px; line-height: 20px;&quot;&gt;when the function is defined&lt;/span&gt;.&lt;br /&gt;
Rule 3: When we use the predefined functions/ library functions we must include the header file.&lt;br /&gt;
Rule 4: According to the Editors we must mention the header file.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;First Program&lt;/h2&gt;&lt;table bgcolor=&quot;cyan&quot; border=&quot;2&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;stdio.h&gt; main()&lt;br /&gt;
{&lt;br /&gt;
printf(&quot; Welcome to the C Sample Code &quot;);&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;br /&gt;
&lt;/stdio.h&gt;&lt;br /&gt;
&lt;b&gt;Output:&lt;/b&gt;&lt;br /&gt;
Welcome to the C Sample Code&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;h3&gt;Explanation &lt;/h3&gt;stdio.h it is a header file used for input and output purpose &lt;br /&gt;
printf() it is a function used to display the statement in the output screen.&lt;br /&gt;
Syntax: printf(&quot;statement&quot;);&lt;br /&gt;
There is a rule for us every program is should start with main() and it is user defined function &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Let us See the Next program accepting the integer value and display the value in the output screen&lt;/h3&gt;&lt;br /&gt;
&lt;table bgcolor=&quot;cyan&quot; border=&quot;2&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;stdio.h&gt; main()&lt;br /&gt;
{&lt;br /&gt;
int no;&lt;br /&gt;
printf(&quot;\n Enter a number: &quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;no&quot;);&lt;br /&gt;
printf(&quot;\n You Entered Number is : &amp;nbsp;%d&quot;,no);&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;br /&gt;
&lt;/stdio.h&gt;&lt;br /&gt;
&lt;b&gt;Output:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
Enter a Number: 34&lt;br /&gt;
You Entered Number is : &amp;nbsp;34&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
In the above program we used scanf(), %d&quot; and \n.&lt;br /&gt;
scanf(): it is a function used to accept the values in the run time of the program.&lt;br /&gt;
Syntax: scanf(&quot;formatspecifier&quot;,&amp;amp;variable_name);&lt;br /&gt;
&lt;br /&gt;
Format Specifier: it is used to accept the value or displaying the value in the program.&lt;br /&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;Format Specifier&lt;/td&gt;&lt;td&gt;Datatype&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;%c&lt;/td&gt;&lt;td&gt;char&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;%f&lt;/td&gt;&lt;td&gt;float&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;%d&lt;/td&gt;&lt;td&gt;double&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;%d&lt;/td&gt;&lt;td&gt;int&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;%s&lt;/td&gt;&lt;td&gt;string&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&amp;amp; is used to specify the address location for the &lt;a href=&quot;http://csamplecode.blogspot.in/2012/05/c-language.html&quot;&gt;variables&lt;/a&gt; (Future we discuss about the variables location in the pointer concept)&lt;br /&gt;
&lt;br /&gt;
Escape Sequences: it is used to format the output screen in the c editor&lt;br /&gt;
\n &amp;nbsp;is used to specify for the new line.&lt;br /&gt;
\a &amp;nbsp;is used to specify for the beep sound.&lt;br /&gt;
\b &amp;nbsp;is used to specify for the backspace.&lt;br /&gt;
\t &amp;nbsp;is used to specify for the tab space.&lt;br /&gt;
\&quot; is used to specify for the &quot; in the output screen.&lt;br /&gt;
\r is used to specify for the home.&lt;br /&gt;
\* */comment lines&lt;br /&gt;
&lt;br /&gt;
Let us see the next program accept two variables and find the sum of two numbers&lt;br /&gt;
&lt;br /&gt;
&lt;table bgcolor=&quot;cyan&quot; border=&quot;2&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;stdio.h&gt; main()&lt;br /&gt;
{&lt;br /&gt;
int a,b,c;&lt;br /&gt;
printf(&quot;\n Enter two numbers: &quot;);&lt;br /&gt;
scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b&quot;);/* accepting the values */&lt;/stdio.h&gt;&lt;br /&gt;
&lt;stdio.h&gt;c =a+b ;/*adding the values of a and b and it is placed in the c variable */&lt;br /&gt;
printf(&quot;\n Sum of two values is &amp;nbsp;: &amp;nbsp;%d&quot;,c);&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;br /&gt;
&lt;/stdio.h&gt;&lt;br /&gt;
&lt;b&gt;Output:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
Enter two numbers: 4&lt;br /&gt;
5&lt;br /&gt;
Sum of two values: 9&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csamplecode.blogspot.com/feeds/7176846935052057302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://csamplecode.blogspot.com/2012/05/program-in-c-langauge.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/7176846935052057302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/7176846935052057302'/><link rel='alternate' type='text/html' href='http://csamplecode.blogspot.com/2012/05/program-in-c-langauge.html' title='Program in C Langauge'/><author><name>Santosh Kiran</name><uri>http://www.blogger.com/profile/16147687167871737378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3310357430363067015.post-1448221159062550205</id><published>2012-06-06T05:35:00.003-07:00</published><updated>2012-06-07T02:28:23.687-07:00</updated><title type='text'>Operators in c</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
C Language have rich set of Operators.&lt;br /&gt;
Operator: it is a special symbol used to perform a task on the operand.&lt;br /&gt;
Operand: it is a variable or data item&lt;br /&gt;
Expression: it is a combination of Operands and operators.&lt;br /&gt;
Ex: c= a+b&lt;br /&gt;
where c,a,b are operands &lt;br /&gt;
+,= are operators.&lt;br /&gt;
&lt;h3&gt;Arithmetic Operators&lt;/h3&gt;: It is used to perform a general mathematical operations.&lt;br /&gt;
&lt;table border=&quot;2&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;Operator&lt;/td&gt;&lt;td&gt;Usage&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;+ &lt;/td&gt;&lt;td&gt;Addition&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;- &lt;/td&gt;&lt;td&gt;Subtraction&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;* &lt;/td&gt;&lt;td&gt;Mutliplication&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;/ &lt;/td&gt;&lt;td&gt;Division&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;% &lt;/td&gt;&lt;td&gt;Remainder&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;h3&gt;Assignment Operators &lt;/h3&gt;It is used to assign the values from right hand side to the left hand side. Right hand side may be a variable / Expression / Value constant, But Left hand side must be a variable. To assign the values we use &quot;=&quot; symbol.&lt;br /&gt;
&lt;br /&gt;
tr&amp;gt;  tr&amp;gt;  tr&amp;gt;  tr&amp;gt; &lt;br /&gt;
-=&lt;br /&gt;
&lt;table border=&quot;2&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;Operator&lt;/td&gt;&lt;td&gt;Usage&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;= &lt;/td&gt;&lt;td&gt;Assign the value from R.H.S to L.H.S&lt;br /&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;Eg: a=b means b variable value is assigned to a variable&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;Eg: a=5 means 5 integer constant is stored in a variable&lt;/span&gt;&lt;br /&gt;
Eg: c= a+b means  a and b variable values are added and it is strored in c variable &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;+= &lt;/td&gt;&lt;td&gt;eg: A +=5&lt;br /&gt;
means A= A+5 &lt;br /&gt;
&lt;br /&gt;
5 value constant is added to A variable  the sum value is stored in  A again &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-= &lt;/td&gt;&lt;td&gt;eg: A -=5&lt;br /&gt;
means A= A-5 &lt;br /&gt;
&lt;br /&gt;
5 value constant is  subtracted from A variable  the difference value is stored in  A again &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;*= &lt;/td&gt;&lt;td&gt;eg: A *=5&lt;br /&gt;
means A= A*5 &lt;br /&gt;
&lt;br /&gt;
5 value constant is  multiply to  A variable  the product is  stored in  A again &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;*= &lt;/td&gt;&lt;td&gt;eg: A /=5&lt;br /&gt;
means A= A/5 &lt;br /&gt;
&lt;br /&gt;
5 value constant is  division with  A variable and the quotient value  is  stored in  A &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;/= &lt;/td&gt;&lt;td&gt;eg: A /=5&lt;br /&gt;
means A= A/5 &lt;br /&gt;
5 value constant is division with A variable and the quiotent value is stored in A &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;%=&lt;/td&gt;&lt;td&gt;eg: A %=5&lt;br /&gt;
means A=A%5&lt;br /&gt;
5 value constant is division with A variable and the remainder value is stored in A&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
+=,-=,*=,/=,%= are called as shorthand notations.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Relational Operators&lt;/h2&gt;It is used to check the simple conditions in the clanguage&lt;br /&gt;
&lt;table align=&quot;center&quot; border=&quot;1&quot; cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; style=&quot;width: 500px;&quot;&gt;&lt;thead&gt;
&lt;tr&gt;      &lt;th scope=&quot;col&quot;&gt;&lt;br /&gt;
Operator&lt;/th&gt;      &lt;th scope=&quot;col&quot;&gt;&lt;br /&gt;
Usage&lt;/th&gt;     &lt;/tr&gt;
&lt;/thead&gt;    &lt;tbody&gt;
&lt;tr&gt;      &lt;td&gt;&lt;br /&gt;
&amp;lt;&lt;/td&gt;      &lt;td&gt;&lt;br /&gt;
greater than&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;      &lt;td&gt;&lt;br /&gt;
&amp;lt;=&lt;/td&gt;      &lt;td&gt;&lt;br /&gt;
greater than or equal to&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;      &lt;td&gt;&lt;br /&gt;
&amp;gt;&lt;/td&gt;      &lt;td&gt;&lt;br /&gt;
less than&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;      &lt;td&gt;&lt;br /&gt;
&amp;gt;=&lt;/td&gt;      &lt;td&gt;&lt;br /&gt;
less than or equal to&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;      &lt;td&gt;&lt;br /&gt;
= =&lt;/td&gt;      &lt;td&gt;&lt;br /&gt;
comparision (equal to)&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;      &lt;td&gt;&lt;br /&gt;
!=&lt;/td&gt;      &lt;td&gt;&lt;br /&gt;
Not Equal to&lt;/td&gt;     &lt;/tr&gt;
&lt;/tbody&gt;   &lt;/table&gt;&lt;br /&gt;
&lt;h2&gt;Logical Operators &lt;/h2&gt;It is used to combine more than one conditions into a single conditions and all the conditions  are treat as single condition.&lt;br /&gt;
We have two operators&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; style=&quot;width: 500px;&quot;&gt;&lt;thead&gt;
&lt;tr&gt;      &lt;th scope=&quot;col&quot;&gt;&lt;br /&gt;
Operator&lt;/th&gt;      &lt;th scope=&quot;col&quot;&gt;&lt;br /&gt;
Usage&lt;/th&gt;     &lt;/tr&gt;
&lt;/thead&gt;    &lt;tbody&gt;
&lt;tr&gt;      &lt;td&gt;&lt;br /&gt;
&amp;amp;&amp;amp; (and)&lt;/td&gt;      &lt;td&gt;&lt;br /&gt;
it is used to combine more than one condition as a single condition. if all the conditions are true than total condition is true other wise if one condition is false than total condition is false.&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;      &lt;td&gt;&lt;br /&gt;
|| (or)&amp;nbsp;&lt;/td&gt;      &lt;td&gt;&lt;br /&gt;
it is used to combine more than one condition as a single condition. if any one &amp;nbsp;condition is &amp;nbsp;true than total condition is true&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;
&lt;/tbody&gt;   &lt;/table&gt;&lt;br /&gt;
&lt;h2&gt;Terinary Operators&lt;/h2&gt;it is used to check the condition if the condition is true it executes true set of statements other wise it executes false set of statements.&lt;br /&gt;
Syntax: (cond)? true_statement:false_statement;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Example:&lt;/span&gt;&lt;/u&gt;&lt;i&gt; Write a C Program accept a number and check whether it is even or odd &lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;main()&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp;int a;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;printf(&quot;\n Enter a Number: &quot;);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;scanf(&quot;%d&quot;,&amp;amp;a); /* accepting a number */&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;(a%2= =0)? /* &amp;nbsp;checking the condition */&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; printf(&quot;\n %d is an even no&quot;,a):&amp;nbsp;printf(&quot;\n %d is an odd no&quot;,a);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;}&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b style=&quot;text-decoration: underline;&quot;&gt;Explanation:&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In the above program i accepted a number in the runtime and checking whether it is even or odd for this program first of all i must accept a number from the run time(out put screen) and the value should not be floating value( decimal values) for this reason i declare a variable datatype should be int and it stores the value from &amp;nbsp;-32768 to 32767 &amp;nbsp;and it occupies two bytes memory. By using the scanf i accepted and %d is format specifier for the integer datatype &lt;a href=&quot;http://csamplecode.blogspot.in/2012/05/program-in-c-langauge.html&quot;&gt;(click here to see the format specifiers&lt;/a&gt;). Main task of the program is to check whether it is even or odd means if any number is divisible by 2 and remainder is 0 we say as even number other wise it is odd number here i required two operators 1. % &amp;nbsp;and 2. = = ( it is used to check the output value is equal to zero or not).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: bold; text-decoration: underline;&quot;&gt;OUTPUT: &lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;Enter a number: 5&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5 is an odd no&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csamplecode.blogspot.com/feeds/1448221159062550205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://csamplecode.blogspot.com/2012/06/operators-in-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/1448221159062550205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/1448221159062550205'/><link rel='alternate' type='text/html' href='http://csamplecode.blogspot.com/2012/06/operators-in-c.html' title='Operators in c'/><author><name>Santosh Kiran</name><uri>http://www.blogger.com/profile/16147687167871737378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3310357430363067015.post-6658200674010605797</id><published>2012-06-05T01:22:00.002-07:00</published><updated>2012-06-07T02:29:03.434-07:00</updated><title type='text'>Decision Making Statements</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;In C Language doesn&#39;t follow the sequence follow means top to bottom. C Program flow can be change by the programmer by using Control Structures. In C Language we have three types of Control Structures&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;b&gt;Decision Making Statements&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Looping Control Structures / Iterative Control Statements&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Unconditional&amp;nbsp;Control Structures / Jumping Statements&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;Decision Making Statements: it is used to check the condition if the condition is true it executes the true set of statements otherwise it executes the false set of statements.&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;Decision Making Statements&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;b&gt;If Statements&lt;/b&gt;&lt;/li&gt;
&lt;ol type=&quot;A&quot;&gt;&lt;li&gt;&lt;b&gt;simple if&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;if else&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;if else if (or) if ladder&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt; Nested if&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;li&gt;&lt;b&gt;Switch Statements&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;Simple if&lt;/b&gt;&lt;/span&gt;: it is used to check the conditions. if the condition is true it executes the true set of statements otherwise if the condition is failed and rest of the program will be&amp;nbsp;continuous.&amp;nbsp;&lt;/div&gt;&lt;b&gt;Syntax: if (cond)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; statements;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&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/AVvXsEhKnysSnjB9-fuc8X0tCS3dNJVh5P0KRBYbOdcAi6_m663CWI4RUYKy_FlXyrvyPHal6qmYU0PPVEr61Y6JgO12u6lEHtK0SwFVDzk6H88OyWoY29HEMSci_ppG1xyL6gojLmbF8Ujv55-Y/s1600/simpleif.JPG&quot; imageanchor=&quot;simple if&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;191&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKnysSnjB9-fuc8X0tCS3dNJVh5P0KRBYbOdcAi6_m663CWI4RUYKy_FlXyrvyPHal6qmYU0PPVEr61Y6JgO12u6lEHtK0SwFVDzk6H88OyWoY29HEMSci_ppG1xyL6gojLmbF8Ujv55-Y/s320/simpleif.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;If Else&lt;/b&gt;&lt;/span&gt;: it is used to check the condition. if the condition is true it executes the true set of statements otherwise it executes the false set if statements and rest of the program will be&amp;nbsp;continuous.&lt;br /&gt;
&lt;b&gt;Syntax: if (cond)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; statements;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;statements;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&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/AVvXsEgl8Giu-eVe78q4vy1KoT2XOtyYeJCSw-VTAebm5Pvd5ZyAELM88PmGkT_COKZdu2wZjFCpwp5o-EQg3fqvoVyaUqBYdAd8oMSJQNR-vpyAGfw0FWrpYxpZb1aMeVGDDVMYWvKa5EACXY6L/s1600/ifelse.JPG&quot; imageanchor=&quot;if else&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;191&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl8Giu-eVe78q4vy1KoT2XOtyYeJCSw-VTAebm5Pvd5ZyAELM88PmGkT_COKZdu2wZjFCpwp5o-EQg3fqvoVyaUqBYdAd8oMSJQNR-vpyAGfw0FWrpYxpZb1aMeVGDDVMYWvKa5EACXY6L/s320/ifelse.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;If Else if or If Ladder&lt;/b&gt;&lt;/span&gt;: it is used to check&amp;nbsp;multiple conditions.&lt;br /&gt;
&lt;b&gt;Syntax: if (cond)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; statements;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else if( cond )&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;statements;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;else if( cond )&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;statements;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else if( cond )&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;statements;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;else if( cond )&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;statements;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;||&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;||&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; statements;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;Note&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;: &amp;nbsp;if any one condition is true that block will be executed and rest of the statements will not executed. If all conditions are false than else block will be&amp;nbsp;executed.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;Nested if&lt;/b&gt;&lt;/span&gt;: In one if we are writing another if is called as Nested if.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;Switch&amp;nbsp;&lt;/b&gt;&lt;/span&gt;: It is a multiway decision statements used to perform = =( equal to operator) operations where as in if ladder we can perform all operators.&lt;br /&gt;
&lt;b&gt;Syntax: switch(variablename/exression)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case val1: statements; break;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case val2: statements; break;&lt;/b&gt; &lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case val3: statements; break;&lt;/b&gt; &lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case val4: statements; break;&lt;/b&gt; &lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case val5: statements; break;&lt;/b&gt; &lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;||&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;||&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; default: statement;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Note: if we forget to write the break keyword for the case, next case statement will be executed if the condition is false.&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csamplecode.blogspot.com/feeds/6658200674010605797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://csamplecode.blogspot.com/2012/06/decision-making-statements.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/6658200674010605797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/6658200674010605797'/><link rel='alternate' type='text/html' href='http://csamplecode.blogspot.com/2012/06/decision-making-statements.html' title='Decision Making Statements'/><author><name>Santosh Kiran</name><uri>http://www.blogger.com/profile/16147687167871737378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKnysSnjB9-fuc8X0tCS3dNJVh5P0KRBYbOdcAi6_m663CWI4RUYKy_FlXyrvyPHal6qmYU0PPVEr61Y6JgO12u6lEHtK0SwFVDzk6H88OyWoY29HEMSci_ppG1xyL6gojLmbF8Ujv55-Y/s72-c/simpleif.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3310357430363067015.post-3202904843143196105</id><published>2012-06-01T02:22:00.001-07:00</published><updated>2012-06-07T02:29:41.362-07:00</updated><title type='text'>Looping Control Structures</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In C Language We have three types of loops&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;while loop: it is a precondition loop, first of all it checks the condition if the condition is true it executes the looping statements and incrementation / decrementation will done and again it check the condition.&lt;br /&gt;
Syntax: intilization;&lt;br /&gt;
while (cond)&lt;br /&gt;
{&lt;br /&gt;
statements;&lt;br /&gt;
inc/dec; &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/AVvXsEgLQlSSHYWV5FmSE8s6Qbjno8cBLaLDvO9zOdhZcp1ejUbtOML0KW1aT_FM8taToXrNbimmfPW7nsu7jJx-bWpkmxK41F9oKw5OVOtgrvWpuOqfaEepW1g7Mp3gE5N9Tf_wSfF-j-eH_c7j/s1600/while+loop.jpg&quot; imageanchor=&quot;while loop in c&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLQlSSHYWV5FmSE8s6Qbjno8cBLaLDvO9zOdhZcp1ejUbtOML0KW1aT_FM8taToXrNbimmfPW7nsu7jJx-bWpkmxK41F9oKw5OVOtgrvWpuOqfaEepW1g7Mp3gE5N9Tf_wSfF-j-eH_c7j/s1600/while+loop.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;do while loop: it is a post condition loop, First of all looping statements will be executed than it checks the condition if the true it enters into the loop other wise it come outside from the loop.&lt;br /&gt;
Syntax: intilization;&lt;br /&gt;
do&lt;br /&gt;
{&lt;br /&gt;
statements;&lt;br /&gt;
inc/dec; &lt;br /&gt;
}&lt;br /&gt;
while(cond);&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/AVvXsEiIgTsuSdG7Dbpibwr27r5P9cL348EDMhXU3VOZa3DsltyWajy6buEFnIPOGhQMWD_x5GvFV-5WYHHZ3Wxe0_fwamyCeWze9l8lXX1TOFqn8iWVf4VTUpu5Q08hjFKOCbuBFZp8fBIaaIA6/s1600/dowhile+loop.jpg&quot; imageanchor=&quot;do while loop in c&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIgTsuSdG7Dbpibwr27r5P9cL348EDMhXU3VOZa3DsltyWajy6buEFnIPOGhQMWD_x5GvFV-5WYHHZ3Wxe0_fwamyCeWze9l8lXX1TOFqn8iWVf4VTUpu5Q08hjFKOCbuBFZp8fBIaaIA6/s320/dowhile+loop.jpg&quot; width=&quot;260&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;for loop: it is same as while loop and it is a precondition loop. In for loop all the 3 statements are written in a single line. i.e. intilization, condition, incrementation/decrementation.&lt;br /&gt;
Syntax: for(inti;cond;inc/dec)&lt;br /&gt;
{&lt;br /&gt;
statements;&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/AVvXsEj_dCAyZ0epBYsB_-LcJb3Kht_0Ip64FW2Z59FJFabSO8DtVhC5ThyphenhyphengrWitsSAR8GKP_GWCMlS1GvLUQMTEPxzpuKN8y2VPI7hAMSXiEa3gTzLxDFpJ2wLXRqiA_vpUXWXDaz7x__fCv93E/s1600/for+loop.jpg&quot; imageanchor=&quot;for loop in c&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_dCAyZ0epBYsB_-LcJb3Kht_0Ip64FW2Z59FJFabSO8DtVhC5ThyphenhyphengrWitsSAR8GKP_GWCMlS1GvLUQMTEPxzpuKN8y2VPI7hAMSXiEa3gTzLxDFpJ2wLXRqiA_vpUXWXDaz7x__fCv93E/s1600/for+loop.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csamplecode.blogspot.com/feeds/3202904843143196105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://csamplecode.blogspot.com/2012/06/looping-control-structures.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/3202904843143196105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/3202904843143196105'/><link rel='alternate' type='text/html' href='http://csamplecode.blogspot.com/2012/06/looping-control-structures.html' title='Looping Control Structures'/><author><name>Santosh Kiran</name><uri>http://www.blogger.com/profile/16147687167871737378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLQlSSHYWV5FmSE8s6Qbjno8cBLaLDvO9zOdhZcp1ejUbtOML0KW1aT_FM8taToXrNbimmfPW7nsu7jJx-bWpkmxK41F9oKw5OVOtgrvWpuOqfaEepW1g7Mp3gE5N9Tf_wSfF-j-eH_c7j/s72-c/while+loop.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3310357430363067015.post-5886439688458868002</id><published>2012-05-31T02:59:00.002-07:00</published><updated>2012-06-07T04:18:44.822-07:00</updated><title type='text'>Jumping Statments / UnConditional Control Structures</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
In C Language we have&amp;nbsp;Unconditional&amp;nbsp;Control Structures:&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;break&lt;/li&gt;
&lt;li&gt;continue&lt;/li&gt;
&lt;li&gt;goto&lt;/li&gt;
&lt;li&gt;exit()&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt;break: it is used to break the flow of the program at a particular condition.&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;Example for break keyword:&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;main()&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; int i;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;printf(&quot;\n A Good Example for Break: &quot;);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp;for(i=1;i&amp;lt;=10;i++)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(i==5)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot;\t%d&quot;,i);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Output: A Good Example for Break: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;continue: it used to skip the iteration in the loops for a particular condition.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;b&gt;Example for continue keyword:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;main()&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;{&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; int i;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;printf(&quot;\n A Good Example for Break: &quot;);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp;for(i=1;i&amp;lt;=10;i++)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;b&gt;printf(&quot;\t%d&quot;,i);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(i==5)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot;\n Loop is continued &quot;);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; continue;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;}&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Output: A Good Example for Continue: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Loop is continued &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;exit(): it is used to terminate the program and it is a function.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;b&gt;Example for exit():&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;main()&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;{&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; int i;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;printf(&quot;\n A Good Example for exit(): &quot;);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp;for(i=1;i&amp;lt;=10;i++)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp;{&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(i==5)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{ &amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot;\n Program is terminated&quot;);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; getch();&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; exit();&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot;\t%d&quot;,i);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;}&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Output: A Good Example for exit() : &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 &amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Program is terminated&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;goto: it is used to execute the particular statement&amp;nbsp;continuously&amp;nbsp;when condition is given.&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;Write a program accept a number and display the numbers from 1 to n with out using loops&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;div&gt;&lt;b&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;main()&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;{&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; int i,n;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; printf(&quot;Enter a Number: \n&quot;);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; scanf(&quot;%d&quot;,&amp;amp;n);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;i=1;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;hai:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(&quot;\t %d&quot;,i++);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if(i&amp;lt;=n)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; goto hai;&lt;/b&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;}&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Output: Enter a Number: 5&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csamplecode.blogspot.com/feeds/5886439688458868002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://csamplecode.blogspot.com/2012/06/jumping-statments-unconditional-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/5886439688458868002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/5886439688458868002'/><link rel='alternate' type='text/html' href='http://csamplecode.blogspot.com/2012/06/jumping-statments-unconditional-control.html' title='Jumping Statments / UnConditional Control Structures'/><author><name>Santosh Kiran</name><uri>http://www.blogger.com/profile/16147687167871737378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3310357430363067015.post-9131025565753083834</id><published>2012-05-30T00:25:00.000-07:00</published><updated>2012-06-08T00:35:24.506-07:00</updated><title type='text'>Examples On Control Structures</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this page you can see some examples on Control Structures&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;write a c Program accept three numbers and check which one of them is greatest by using if else&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;Solution:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;main()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int a,b,c;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; clrscr(); /* to clear the screen */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot;\n Enter three numbers: &quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scanf(&quot;%d%d%d&quot;,&amp;amp;a,&amp;amp;b,&amp;amp;c);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(a&amp;gt;b&amp;amp;&amp;amp;a&amp;gt;c)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(&quot;\n %d is greatest&quot;,a);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(b&amp;gt;c)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(&quot;\n %d is greatest&quot;,b);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(&quot;\n %d is greatest&quot;,c);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;getch();&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output: Enter Three Numbers: 5 7 0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7 is greatest&amp;nbsp;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csamplecode.blogspot.com/feeds/9131025565753083834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://csamplecode.blogspot.com/2012/05/examples-on-control-structures.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/9131025565753083834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3310357430363067015/posts/default/9131025565753083834'/><link rel='alternate' type='text/html' href='http://csamplecode.blogspot.com/2012/05/examples-on-control-structures.html' title='Examples On Control Structures'/><author><name>Santosh Kiran</name><uri>http://www.blogger.com/profile/16147687167871737378</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>