<?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-8399007682609351165</id><updated>2024-09-08T06:59:48.376-07:00</updated><title type='text'>Course Zone</title><subtitle type='html'>Its time to learn something!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-5663793711644395931</id><published>2010-09-21T04:08:00.002-07:00</published><updated>2010-09-21T04:11:33.091-07:00</updated><title type='text'>Nested IF and ELSE IF Ladder</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;u&gt;iii. Nested IF....ELSE&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;General Form:&lt;/i&gt;&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(conditional-expression)
{
    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(conditional-expression)
    {
        statements;
    }
    &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;
    {
        statements;
    }
    statements;
}
&lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;
{
    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(conditional-expression)
    {
        statements;
    }
    statements;
}&lt;/pre&gt;In Nested if ..... else, the if and else part can contain one or more if else statements.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Sample Program : Find the largest among three input numbers.&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;#include&amp;lt;conio.h&amp;gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; main()&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; a,b,c;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;    clrscr();&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;    printf(&lt;span class=&quot;str&quot;&gt;&quot;Enter two numbers : &quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;    scanf(&lt;span class=&quot;str&quot;&gt;&quot;%d%d,%d&quot;&lt;/span&gt;,&amp;amp;a,&amp;amp;b,&amp;amp;c);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(a&amp;gt;b)&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(a&amp;gt;c)&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;            printf(&lt;span class=&quot;str&quot;&gt;&quot;%d is largest&quot;&lt;/span&gt;,a);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;            printf(&lt;span class=&quot;str&quot;&gt;&quot;%d is largest&quot;&lt;/span&gt;,c);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(b&amp;gt;c)&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;            printf(&lt;span class=&quot;str&quot;&gt;&quot;%d is largest&quot;&lt;/span&gt;,b);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  26:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  27:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  28:  &lt;/span&gt;            printf(&lt;span class=&quot;str&quot;&gt;&quot;%d is largest&quot;&lt;/span&gt;,c);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  29:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  30:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  31:  &lt;/span&gt;    getch();&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  32:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;iv. ELSE .... IF LADDER&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;General Form:&lt;/i&gt;&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(test condition)
{

}
&lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(condition)
{

}
&lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(condition)
{

}
&lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;
{

}&lt;/pre&gt;This construct is known as the else if ladder. &amp;nbsp;The conditions are evaluated from the top of the ladder downwards. &amp;nbsp;As soon as a true condition is found, the statement associated with it is executed skipping the rest of the ladder.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Sample Program : Program to read two numbers and an operator which performs the specified operation and display the result.&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;#include&amp;lt;conio.h&amp;gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; main( )&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;   &lt;span class=&quot;kwrd&quot;&gt;float&lt;/span&gt; a,b,res;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;   &lt;span class=&quot;kwrd&quot;&gt;char&lt;/span&gt; op;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;   clrscr( );&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;   printf(&lt;span class=&quot;str&quot;&gt;&quot;Enter two Numbers : &quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;   scanf(&lt;span class=&quot;str&quot;&gt;&quot;%d%d&quot;&lt;/span&gt;,&amp;amp;a,&amp;amp;b);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;   printf(&lt;span class=&quot;str&quot;&gt;&quot;Enter the Operator : &quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;   scanf(&lt;span class=&quot;str&quot;&gt;&quot;%c&quot;&lt;/span&gt;,&amp;amp;op);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;   &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(op==&lt;span class=&quot;str&quot;&gt;&#39;+&#39;&lt;/span&gt;)&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;        res=a+b;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;   &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(op==&lt;span class=&quot;str&quot;&gt;&#39;-&#39;&lt;/span&gt;)&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;        res=a-b;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;   &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(op==&lt;span class=&quot;str&quot;&gt;&#39;*&#39;&lt;/span&gt;)&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;        res=a*b;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;   &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(op==&lt;span class=&quot;str&quot;&gt;&#39;/&#39;&lt;/span&gt;)&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;        res=a/b;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;   &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;   {&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;        printf(&lt;span class=&quot;str&quot;&gt;&quot;Invalid Operator ! \n Press any key to exit...&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;        getch( );&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;        exit(0);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;   }&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  26:  &lt;/span&gt;   printf(&lt;span class=&quot;str&quot;&gt;&quot;%.2f %c %.2f = %.2f&quot;&lt;/span&gt;,a,op,b,res );&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  27:  &lt;/span&gt;   getch( );&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  28:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2010/09/if-statement.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border:none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border:none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/5663793711644395931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2010/09/nested-if-and-else-if-ladder.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/5663793711644395931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/5663793711644395931'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2010/09/nested-if-and-else-if-ladder.html' title='Nested IF and ELSE IF Ladder'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-9016723073482974900</id><published>2010-09-21T04:08:00.000-07:00</published><updated>2010-09-21T04:11:00.183-07:00</updated><title type='text'>The IF Statement</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;The &#39;IF&#39; Statement is a powerful decision making statement and is used to control the flow of execution of statements. &amp;nbsp;It is basically a two way decision making statement and is used with an expression. &amp;nbsp;It takes the following form :&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (test condition)&lt;/pre&gt;It allows the computer to evaluate the test condition first and then depending on whether the value of the expression is true of false it transfers the control to a particular statement.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;i. Simple IF&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;General Form :&lt;/i&gt;&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(test expression)
{
 statement block;
}
statement x;&lt;/pre&gt;If the test expression is true then statement block will be executed otherwise the statement block will be skipped and the execution will be jumped to the statement x. &amp;nbsp;When the condition is true both the statement block and the statement x are executed in sequence.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Sample Program : Find the absolute value of a given number.&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;#include&amp;lt;conio.h&amp;gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; main()&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; num;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;    clrscr();&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;    printf(&lt;span class=&quot;str&quot;&gt;&quot;Enter a number : &quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;    scanf(&lt;span class=&quot;str&quot;&gt;&quot;%d&quot;&lt;/span&gt;,&amp;amp;num);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(num&amp;lt;0)&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;    num=num*-1;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;    printf(&lt;span class=&quot;str&quot;&gt;&quot;Absolute Value : %d&quot;&lt;/span&gt;,num);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;    getch();&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;ii. The IF .... ELSE&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;General Form :&lt;/i&gt;&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(test condition)
{
 statement block1;
}
&lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;
{
 statement block2;
}
statement x;&lt;/pre&gt;If the test expression is true, the statement block 1 will be executed otherwise the statement&amp;nbsp;block&amp;nbsp;2 will get executed. &amp;nbsp;In both the situation statement x will be executed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Sample Program : Find the largest among two input numbers.&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;#include&amp;lt;conio.h&amp;gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; main()&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; a,b;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;    clrscr();&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;    printf(&lt;span class=&quot;str&quot;&gt;&quot;Enter two numbers : &quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;    scanf(&lt;span class=&quot;str&quot;&gt;&quot;%d%d&quot;&lt;/span&gt;,&amp;amp;a,&amp;amp;b);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(a&amp;gt;b)&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;        printf(&lt;span class=&quot;str&quot;&gt;&quot;%d is largest&quot;&lt;/span&gt;,a);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;        printf(&lt;span class=&quot;str&quot;&gt;&quot;%d is largest&quot;&lt;/span&gt;,b);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;    getch();&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/10/deicision-making-and-branching.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border:none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2010/09/nested-if-and-else-if-ladder.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border:none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/9016723073482974900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2010/09/if-statement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/9016723073482974900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/9016723073482974900'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2010/09/if-statement.html' title='The IF Statement'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-5329829355687160474</id><published>2009-10-18T10:10:00.000-07:00</published><updated>2010-09-21T04:09:33.279-07:00</updated><title type='text'>Deicision Making and Branching</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;We have seen that programs are some set of statements written in a specific order.   Processor will executed the programs in the order in which it was written.  We may come to a situation where we need to alter the sequential execution of the statements to achieve some results.  We may need to take some decisions based on the needs of the context for which the program was written and will branch or alter the execution of statements accordingly. &amp;nbsp;For example, if we are preparing a students results publishing program, then we may need to take decision on whether a student is passed or not. &amp;nbsp;If a student gets a specified minimum mark or more he is passed otherwise he is failed, this is a simple kind of decision making, we will implement this in C programs using the some decision making/branching control structures and conditions.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;Conditions are tested for its truth values and if the condition is true then it will execute some statements, if the condition is false it will execute some other statements or will check another condition for its truth values. &amp;nbsp;C supports 4 different decision making statements and are commonly used in all other programming languages.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-decoration: underline;&quot;&gt;Decision making statements in C&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;b&gt;If&lt;/b&gt; statement&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Switch&lt;/b&gt; statement&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Conditional Operators&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Goto&lt;/b&gt; statement&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
Among the 4 decision making statements, If, Switch and Conditional operators are supported by most of the programming languages. &amp;nbsp;Goto statement is a branching statement and is not commonly used in many programming languages and in C itself usage of goto statement is not recommended. &amp;nbsp;Goto statements where the constructs used in the unstructured programming languages for branching and present languages like C, C++, Java etc. possesses structured feature and it follows Sequential, Conditional and Iteration statements in its programs.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/10/c-special-operators-and-operator.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border:none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2010/09/if-statement.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border:none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/5329829355687160474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/10/deicision-making-and-branching.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/5329829355687160474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/5329829355687160474'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/10/deicision-making-and-branching.html' title='Deicision Making and Branching'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-5711439282966938877</id><published>2009-10-09T11:12:00.000-07:00</published><updated>2010-03-25T08:04:45.159-07:00</updated><title type='text'>Special Operators and Operator Precedence in C</title><content type='html'>In the last posts we&#39;ve discussed about C&#39;s all 7 type of operators, now we&#39;ll see which all are the Special operators in C.&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;center&quot; colspan=&quot;3&quot;&gt;Special Operators&lt;br /&gt;
&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&lt;b&gt;Operator&lt;/b&gt;&lt;br /&gt;
&lt;/td&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;br /&gt;
&lt;/td&gt;&lt;td&gt;&lt;b&gt;Example&lt;/b&gt;&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;,&lt;br /&gt;
&lt;/td&gt;&lt;td style=&quot;text-align: center;&quot;&gt;Used to separate a pair of expressions.&amp;nbsp;&lt;br /&gt;
In this example two initialization expressions&lt;br /&gt;
are separated using a comma operator.&lt;br /&gt;
&lt;/td&gt;&lt;td&gt;for(i=1,j=n;i&lt;n;i++,j--)&gt;++,j--)&lt;br /&gt;
&lt;/n;i++,j--)&gt;&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;.&lt;br /&gt;
&lt;/td&gt;&lt;td style=&quot;text-align: center;&quot;&gt;Dot (.) operator is used in C to refer structure&lt;br /&gt;
members.&lt;br /&gt;
&lt;/td&gt;&lt;td&gt;struct student s;&lt;br /&gt;
s.id=1021;&lt;br /&gt;
s.mark=86;&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;sizeof( )&lt;br /&gt;
&lt;/td&gt;&lt;td style=&quot;text-align: center;&quot;&gt;Size of operator is used to compute the size of&lt;br /&gt;
any variable or any type. It will return the size in bytes.&lt;br /&gt;
&lt;/td&gt;&lt;td&gt;sizeof(int);&lt;br /&gt;
char grade;&lt;br /&gt;
sizeof(grade);&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;-&amp;gt;&lt;br /&gt;
&lt;/td&gt;&lt;td style=&quot;text-align: center;&quot;&gt;Arrow operator is used to access structure&lt;br /&gt;
members using a structure pointer variable.&lt;br /&gt;
&lt;/td&gt;&lt;td&gt;struct student p*;&lt;br /&gt;
p=&amp;amp;s;&lt;br /&gt;
p-&amp;gt;id;&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;Notes&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Comma operator is used to separate a pair of instructions, its commonly used in &lt;i&gt;for loop&lt;/i&gt; to initialize or update more than one variable.&amp;nbsp; For example : for(i=0,j=n;i&lt;n;i++,j--), a=&quot;&quot; and=&quot;&quot; another=&quot;&quot; are=&quot;&quot; comma=&quot;&quot; example=&quot;&quot; expressions=&quot;&quot; i++=&quot;&quot; i=&quot;0,j=n&quot; in=&quot;&quot; is=&quot;&quot; j--=&quot;&quot; likewise=&quot;&quot; operator.=&quot;&quot; operator=&quot;&quot; separated=&quot;&quot; this=&quot;&quot; two=&quot;&quot; using=&quot;&quot;&gt;&lt;br /&gt;
&lt;/n;i++,j--),&gt;&lt;/li&gt;
&lt;li&gt;If we defined a user defined structure data type, then its members are accessed its variable by a dot (.) operator.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;sizeof( ) operator is a special operator, which will take a variable or a type as argument and will return the size of its argument in bytes.&amp;nbsp; For example, sizeof(int) will return 2. char ch; sizeof(ch) will return 1.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;-&amp;gt; operator is used with structure pointers to access the structure members.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;u&gt;&lt;b&gt;Operator Precedence and Associativity&lt;br /&gt;
&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
When a combination of operators are used in an expression, then that mixed expression will be evaluated in the order of precedence of the operator used in that operation.&amp;nbsp; BODMAS theoram is applicable to the precedence&amp;nbsp; for arithmetic operators.&amp;nbsp; The following is the precedence of the C operators :&lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp; ( )&lt;br /&gt;
2.&amp;nbsp; ++, --, !, sizeof( )&lt;br /&gt;
3.&amp;nbsp; /, %, *&lt;br /&gt;
4.&amp;nbsp; +, -&lt;br /&gt;
5.&amp;nbsp; &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=&lt;br /&gt;
6.&amp;nbsp; !=, ==&lt;br /&gt;
7.&amp;nbsp; &amp;amp;&amp;amp;&lt;br /&gt;
8.&amp;nbsp; ||&lt;br /&gt;
9.&amp;nbsp; ? :&lt;br /&gt;
10. All assignment and shorthand operators.&lt;br /&gt;
11. ,&lt;br /&gt;
&lt;br /&gt;
If more than one same operator used in an expression then it will be evaluated in the order of its &lt;b&gt;associativity &lt;/b&gt;rule.&amp;nbsp; !, ++, --, ? :, =,&amp;nbsp; +=, -=, *=, /= are evaluated from Right to left and rest of all operators discussed above are evaluated from Left to right.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/09/conditional-operators.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/10/deicision-making-and-branching.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/5711439282966938877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/10/c-special-operators-and-operator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/5711439282966938877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/5711439282966938877'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/10/c-special-operators-and-operator.html' title='Special Operators and Operator Precedence in C'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-1253955372837938722</id><published>2009-09-20T07:58:00.000-07:00</published><updated>2010-03-25T08:01:21.269-07:00</updated><title type='text'>Conditional Operators, Increment/Decrement and Bitwise perators</title><content type='html'>&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;center&quot; colspan=&quot;3&quot;&gt;Conditional Operators&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&lt;b&gt;Operator&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Usage&lt;/b&gt;&lt;/td&gt;&lt;td width=&quot;40%&quot;&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;? :&lt;/td&gt;&lt;td&gt;(Condition)?(Expr 1):(Expr 2);&lt;/td&gt;&lt;td&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div style=&quot;text-align: center;&quot;&gt;Condition will be tested&amp;nbsp;and if it is true then expression 1 will be&amp;nbsp;evaluated, if the the condition is false then&amp;nbsp;expression 2 will be executed.&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;Notes&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Conditional operator is a ternary operator as because it takes 3 operands.&lt;/li&gt;
&lt;li&gt;Conditional operator is used for making decisions.  A test condition is evaluted and if it is true then the expression or value immediately follows the ? will get executed, and if the condition is false, then expression or value after the : will get executed.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;center&quot; colspan=&quot;3&quot;&gt;Increment/Decrement Operators&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&lt;b&gt;Operator&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Use&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;++ (Increment)&lt;/td&gt;&lt;td&gt;i++ or ++i&lt;/td&gt;&lt;td&gt;Increment the value of i by 1.  If the value of i is 1, then&lt;br /&gt;
after execution of i++, value of i will be 2.&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;-- (Decrement)&lt;/td&gt;&lt;td&gt;i-- or --i&lt;/td&gt;&lt;td&gt;Decrement value of i by 1.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;Notes&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;Increment and Decrement operators are unary operators and which takes only one operand&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;Increment/Decrement operator can be used in place where we need to increment the value of an operand by one.  For example i=i+1 can be replaced with i++, similary i-- can be used instead of i=i-1&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;These operators can take two forms : Post increment/Post decrement and Pre increment/Pre decrement.  If an increment/decrement operator is used before the variable then it is pre increment/pre decrement operator and if it is written after the variable then it is called post increment/post decrement.&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;The difference between the pre and post operator occurs when it is used in an expression.  In pre incrementing/pre decrementing the value of the variable is incremented/decremented first and then new value is taken with the expression.  In post incrementing/decrementing, the value of the variable is incremented/decremented only after evaluation of execution.  So the current value of variable will be used with the expression and after its execution the value will be incremented or decremented&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;center&quot; colspan=&quot;3&quot;&gt;Assignment/Short hand Operators&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&lt;b&gt;Operator&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Usage&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;= (Assignment)&lt;/td&gt;&lt;td&gt;a=5; b=i+10;&lt;/td&gt;&lt;td&gt;Used to assign the value to a variable.  Value 5 will be assigned to a&amp;nbsp;and likewise resultant value of the expression i+10 will be assigned to b.&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;+=&lt;/td&gt;&lt;td&gt;a+=2;&lt;/td&gt;&lt;td&gt;Short hand assignment operation.  Value 2 will be added with a and the result stored in a and is similar to the expression a=a+2.&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;-=&lt;/td&gt;&lt;td&gt;a-=b;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Subtract b from a and store the result in a, similar to a=a-b.&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;*=&lt;/td&gt;&lt;td&gt;a*=a;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Square the value of a and store it in a (a=a*a).&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;/=&lt;/td&gt;&lt;td&gt;a/=2;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Divide a by 2 and store the quotient in a (a=a*2).&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;%=&lt;/td&gt;&lt;td&gt;a%=b;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Find the remainder of the operation a/b and store the remainder in a (a=a%b).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;Notes&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;+=,-=, *=, /=, %= is also known as short hand operators.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;center&quot; colspan=&quot;3&quot;&gt;Bitwise Operators&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&lt;b&gt;Operator&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Meaning&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&amp;amp; (Bitwise AND)&lt;/td&gt;&lt;td&gt;A &amp;amp; B&lt;/td&gt;&lt;td&gt;&lt;div style=&quot;text-align: left;&quot;&gt;It will check the binary values of A and B, and result&amp;nbsp;will be 1 corresponding bit positions of both the binary values&amp;nbsp;are 1 otherwise it will be 0. For example : 01011 &amp;amp; 11010 =&amp;gt; 01010&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;| (Bitwise inclusive OR)&lt;/td&gt;&lt;td&gt;A | B&lt;/td&gt;&lt;td&gt;Bit value is set to 1 if either binary bit values are 1 or if any one bit is 1, otherwise it will be set to 0.  For example : 01011 | 11010 =&amp;gt; 11011&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;^ (Bitwise exclusive OR)&lt;/td&gt;&lt;td&gt;A ^ B&lt;/td&gt;&lt;td&gt;Bitwise exclusive OR operator sets a 1 in each bit positions where its operands have different bits, if the bit values are same then it will set a 0.  For example : 01011 ^ 11010 =&amp;gt; 10001&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;~ (1&#39;s complement)&lt;/td&gt;&lt;td&gt;~A&lt;/td&gt;&lt;td&gt;Produces 1&#39;s complement of an integer, this operator Will invert bit values.  1&#39; complement operator will change the bits 0 to 1 and 1 to 0.  For example : ~01011 =&amp;gt; 10100&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&amp;lt;&amp;lt; (Left shift)&lt;/td&gt;&lt;td&gt;A &amp;lt;&amp;lt; B &lt;/td&gt;&lt;td&gt;Shift bits of A by B distance to the left, shifted bits will be lost and vaccated least significant bits will be filled with 0&#39;s .&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&amp;gt;&amp;gt; (Right shift)&lt;/td&gt;&lt;td&gt;A &amp;gt;&amp;gt; B&lt;/td&gt;&lt;td&gt;Shift bits of A by B distance to the right, shifted bits will be lost and vaccated most significant bits will be filled with 0&#39;s .&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;Notes&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Bitwise operators make C unique in high level languages, and this is because C is known as high level language with low level features.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/09/operators-in-c.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/10/c-special-operators-and-operator.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/1253955372837938722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/09/conditional-operators.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/1253955372837938722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/1253955372837938722'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/09/conditional-operators.html' title='Conditional Operators, Increment/Decrement and Bitwise perators'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-6694541571091662472</id><published>2009-09-20T00:40:00.003-07:00</published><updated>2010-03-25T08:02:49.708-07:00</updated><title type='text'>Operators in C</title><content type='html'>&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;center&quot; colspan=&quot;3&quot;&gt;Arithmetic Operators&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&lt;b&gt;Operator&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;+&lt;/td&gt;&lt;td&gt;To add two numeric values&lt;/td&gt;&lt;td&gt;a+b&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;-&lt;/td&gt;&lt;td&gt;Used for subtraction&lt;/td&gt;&lt;td&gt;a-b&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;To multiply two numeric values&lt;/td&gt;&lt;td&gt;a*b&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;/&lt;/td&gt;&lt;td&gt;Used for division&lt;/td&gt;&lt;td&gt;a/b&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;% (Modulo operator)&lt;/td&gt;&lt;td&gt;To compute the remainder of a division operation&lt;/td&gt;&lt;td&gt;a%b&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;Notes&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;An arithmetic operation on two integer values always yields an integer result.&lt;/li&gt;
&lt;li&gt;Operation between float and float yields a float result.&lt;/li&gt;
&lt;li&gt;Operation on integer and a float value will results a float result&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;% operator cannot be used with float or double values&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;center&quot; colspan=&quot;3&quot;&gt;Relational Operators&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&lt;b&gt;Operator&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Use&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&amp;gt;&lt;/td&gt;&lt;td&gt;a&amp;gt;b&lt;/td&gt;&lt;td&gt;Expression return true &lt;i&gt;if a is greater than b&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&amp;gt;=&lt;/td&gt;&lt;td&gt;a&amp;gt;=b&lt;/td&gt;&lt;td&gt;True if &lt;i&gt;a is greater than or equal to b&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&amp;lt;&lt;/td&gt;&lt;td&gt;a&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;/td&gt;&lt;td&gt;True if &lt;i&gt;a is less than b&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&amp;lt;=&lt;/td&gt;&lt;td&gt;a&amp;lt;=b&lt;/td&gt;&lt;td&gt;True if &lt;i&gt;a is less than or equal to b&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;==&lt;/td&gt;&lt;td&gt;a==b&lt;/td&gt;&lt;td&gt;True if &lt;i&gt;a is equal to b&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;!=&lt;/td&gt;&lt;td&gt;a==b&lt;/td&gt;&lt;td&gt;True if &lt;i&gt;a and b are not equal&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;Notes&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Relational operators are comparison operators which will compare two values and will return true or false.&lt;/li&gt;
&lt;li&gt;Relational operators are used in conditional expressions.&lt;/li&gt;
&lt;li&gt;== is an relational operator to check the equality of two values, but a single = operator is assignment operator.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;center&quot; colspan=&quot;3&quot;&gt;Logical Operators&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&lt;b&gt;Operator&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Meaning&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;&amp;amp;&amp;amp;&lt;/td&gt;&lt;td&gt;Logical AND&lt;/td&gt;&lt;td&gt;Combine to&amp;nbsp;conditional&amp;nbsp;expressions, and will return true if both&amp;nbsp;conditional&amp;nbsp;expressions are true otherwise it will return false.&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;||&lt;/td&gt;&lt;td&gt;Logical OR&lt;/td&gt;&lt;td&gt;Combine to&amp;nbsp;conditional&amp;nbsp;expressions, and will return false if both&amp;nbsp;conditional&amp;nbsp;expressions are false otherwise it will return true.&lt;/td&gt;&lt;/tr&gt;
&lt;tr align=&quot;center&quot;&gt;&lt;td&gt;!&lt;/td&gt;&lt;td&gt;Logical NOT&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Negate a conditional expression&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;Notes&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;Logical AND operator is used to combine two conditions, and the whole expression that is connected by the AND (&amp;amp;&amp;amp;) operator will return only true if both conditions are true, otherwise it will return false.&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;Logical OR operator is used to combine two conditions, and the whole expression that is connected by the OR (||) operator will return true if any one condition is true, otherwise it will return false.&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;Logical NOT operator is used to negate the conditional value, if a condition &#39;CON&#39; yields a true then !CON will return false, if condition CON is false then !CON will return true.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/09/operators-and-expressions.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/09/conditional-operators.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/6694541571091662472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/09/operators-in-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/6694541571091662472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/6694541571091662472'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/09/operators-in-c.html' title='Operators in C'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-4715350059666090046</id><published>2009-09-09T12:37:00.000-07:00</published><updated>2010-09-01T21:53:20.189-07:00</updated><title type='text'>Operators and Expressions</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;All processes are done at the Arithmetic &amp;amp; Logic Unit of the computer - ALU.  All operations or processes are performed as arithmetic &amp;amp; Logic operations in ALU.  C is rich with its efficient operators, using which we can easily write efficient programs.  &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Operator is nothing but a symbol which instructs the computer what operation it has to perform&lt;/i&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
In machine languages, an operator may be a combination of binary 0&#39;s and 1&#39;s, i.e. there will be a unique 0&#39;s and 1&#39;s combination for each operations, say for addition, subtraction, comparison etc.  In Assembly language we uses the instruction set to perform the operations, for addition operation we may use ADD instruction, similarly CMP instruction can be used for comparison.  In modern high level languages, we can use symbols similar to those used in maths or real life to instruct the computer for a particular operation.  For example &#39;+&#39; symbol can be used to instruct the computer for an addition operation, similarly &#39;-&#39;,&#39;*&#39;,&#39;/&#39; symbols can be used to perform the other 3 arithmetic operations.&lt;br /&gt;
&lt;br /&gt;
An operator tells the computer what to do with the associated operands.  Operands are the memory values that we need to manipulate to get the results.  So our instructions would be a combination of operators and operands, and such a combination is known as an expression.  For example sum=a+b is an expression and contain 3 operands - sum, a, b and two operators &#39;+&#39; and &#39;=&#39;.  Here + operator directly deal with two operands (a and b) and is used to add two values, so &#39;+&#39; (Addition) operator is a binary operator.  An operator is a &lt;b&gt;&lt;i&gt;binary operator&lt;/i&gt;&lt;/b&gt; if it deal with or uses two operands for operations.  &#39;-&#39; (subtraction) operator is a binary operator and uses two operands - minuend and subtrahend, &#39;-&#39; operator can also be used to represent a negative value, say -10, here &#39;-&#39; is associated with only one operand is a &#39;unary minus&#39;/ &lt;b&gt;&lt;i&gt;unary operator&lt;/i&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Operators are one of the striking feature of C. C supports different types of operators.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Operators in C&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1. Arithmetic Operators [ &lt;b&gt;+&lt;/b&gt; , &lt;b&gt;- &lt;/b&gt;, &lt;b&gt;*&lt;/b&gt;, &lt;b&gt;/&lt;/b&gt;, &lt;b&gt;% &lt;/b&gt;]&lt;br /&gt;
&lt;br /&gt;
2. Relational Operators [ &lt;b&gt;&amp;gt; &lt;/b&gt;, &lt;b&gt;&amp;lt; &lt;/b&gt;, &lt;b&gt;&amp;gt;=&lt;/b&gt;, &lt;b&gt;&amp;lt;=&lt;/b&gt;, &lt;b&gt;==&lt;/b&gt;,&lt;b&gt;!= &lt;/b&gt;]&lt;br /&gt;
&lt;br /&gt;
3. Logic Operators [ &lt;b&gt;&amp;amp;&amp;amp;&lt;/b&gt;, &lt;b&gt;||&lt;/b&gt;,&lt;b&gt; !&lt;/b&gt; ]&lt;br /&gt;
&lt;br /&gt;
4. Assignment Operators [&lt;b&gt; =&lt;/b&gt;, &lt;b&gt;+=&lt;/b&gt;, &lt;b&gt;-=&lt;/b&gt;, &lt;b&gt;*=&lt;/b&gt;, &lt;b&gt;/=&lt;/b&gt; ]&lt;br /&gt;
&lt;br /&gt;
5. Conditional Operators [ &lt;b&gt;?&lt;/b&gt;, &lt;b&gt;:&lt;/b&gt; ]&lt;br /&gt;
&lt;br /&gt;
6. Increment/Decrement Operators [ &lt;b&gt;++&lt;/b&gt;,&lt;b&gt; &lt;/b&gt;&lt;b&gt;--&lt;/b&gt;]&lt;br /&gt;
&lt;br /&gt;
7. Bitwise Operators [ &lt;b&gt;&amp;amp;&lt;/b&gt;, &lt;b&gt;^&lt;/b&gt;, &lt;b&gt;~&lt;/b&gt;, &lt;b&gt;&amp;gt;&amp;gt;&lt;/b&gt;, &lt;b&gt;&amp;lt;&amp;lt; &lt;/b&gt;]&lt;br /&gt;
&lt;br /&gt;
8. Special Operators [ &lt;b&gt;, &lt;/b&gt;&amp;nbsp;&lt;b&gt;.&lt;/b&gt;&amp;nbsp;&lt;b&gt; sizeof() -&amp;gt;&lt;/b&gt;&lt;b&gt; &lt;/b&gt;]&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/08/sample-c-programs.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/09/operators-in-c.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/4715350059666090046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/09/operators-and-expressions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/4715350059666090046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/4715350059666090046'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/09/operators-and-expressions.html' title='Operators and Expressions'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-7943659780333422544</id><published>2009-08-05T12:32:00.000-07:00</published><updated>2010-03-25T02:15:42.676-07:00</updated><title type='text'>Sample C Programs</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;h4&gt;&lt;u&gt;Sailing through Programs&lt;/u&gt;&lt;/h4&gt;Here we will do some sample programs from the knowledge of what we have learned so far.&lt;br /&gt;
&lt;br /&gt;
/* Program to do all arithmetic operations */&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
main( )
{
int a,b,sum,pro,diff,quo;
clrscr( );
printf(&quot;Enter two numbers : &quot;);
scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b);

sum=a+b;
pro=a*b;
diff=a-b;
quo=a/b;

printf(&quot;Sum=%d\n&quot;,sum);
printf(&quot;Difference=%d\n&quot;,diff);
printf(&quot;Product=%d\n&quot;,pro);
printf(&quot;Quotient=%d\n&quot;,quo);
getch( );
}
&lt;/pre&gt;&lt;br /&gt;
In this program we need to do all arithmetic operations on two numbers, so there have to be two variables to store two numbers, and to store the result of four arithmetic operations we need 4 variables.  So we have declared all 6 variables, &#39;a&#39; and &#39;b&#39; for storing two numbers and sum, pro, diff, and quo to store the arithmetical operation&#39;s results.  Whenever you use a variable in your program try to give some meaningful name.&lt;br /&gt;
&lt;br /&gt;
After Declaring two numbers, we are prompting for the user to enter two numbers, and the values thus enter by the user are stored in to &#39;a&#39; and &#39;b&#39;.  So we got that two numbers to perform the arithmetical calculations, then we added all those code to find the sum, product, quotient, and division.  Then print the result we&#39;ve calculated.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;/*Program to Interchange two values without using any other variables*/

#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
main( )
{
int a,b;
clrscr( );
printf(&quot;Enter two numbers : &quot;);
scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b);

printf(&quot;\nBefore Swapping the Values\n&quot;);
printf(&quot;a=%d\tb=%d\n&quot;,a,b);

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

printf(&quot;\nAfter Swapping the Values\n&quot;);
printf(&quot;a=%d\tb=%d\n&quot;,a,b);

getch( );
}
&lt;/pre&gt;&lt;br /&gt;
A simple logic is applied to swap the values.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;Before-&amp;gt; a=10 and b=20&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;a=a+b; /*  a=30 and b=20 */&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;b=a-b;  /* a=30 and b=10 */&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;a=a-b; /* a=20 and b=10 */&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;After-&amp;gt; a=20 and b=10&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;Multiplication and Division technique can also be used to swap the values.  Use the following logic:-&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;Before-&amp;gt; a=10 and b=2&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;a=a*b; /* a=20 and b=2 */&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;b=a/b; /* a=20 and b=10 */&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;a=a/b; /* a=2 and b=10*/&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;After-&amp;gt; a=2 and b=10&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/08/reading-data-from-keyboard.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/09/operators-and-expressions.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/7943659780333422544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/08/sample-c-programs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/7943659780333422544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/7943659780333422544'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/08/sample-c-programs.html' title='Sample C Programs'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-7652811882612687604</id><published>2009-08-04T12:19:00.000-07:00</published><updated>2010-03-25T02:14:36.411-07:00</updated><title type='text'>Reading Data from the Keyboard</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;A program is nothing if it is not accepting any data from the user or outputs some data to the user.  A program is interactive only if it accepts data&#39;s from the user at run time.  It should accepts data needed for the program and output the result based on the user input.  For example a user may want to input basic salary of an employee to calculate his net salary, he can use the same program to calculate the net salary of another employee by inputting different values upon his requirement.&lt;br /&gt;
&lt;br /&gt;
C provides a library function &lt;b&gt;&lt;i&gt;scanf( ) &lt;/i&gt;&lt;/b&gt;that accepts data&#39;s from the keyboard. It uses the following syntax :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;scanf(&quot;control string&quot;,&amp;amp;variable_name&quot;);&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;control string &lt;/i&gt;uses the control string for the type of &lt;i&gt;variable_name, &lt;/i&gt;i.e. if we are reading an integer value then control string will be &lt;i&gt;%d, &lt;/i&gt;if we are reading a character value then the control string is &lt;i&gt;%c&lt;/i&gt;.  Variable name preceded by an ampersand (&amp;amp;) symbol.  &lt;b&gt;&lt;i&gt;Ampersand (&amp;amp;)&lt;/i&gt;&lt;/b&gt; is also known as &lt;i&gt;&lt;b&gt;&quot;address of operator&quot;&lt;/b&gt;&lt;/i&gt;, address of operator instructs the computer where to store the data read from the keyboard.  Ampersand operator provides the memory address of the variable we specified, and the value just inputted stored to that memory location, we can access the value using the variable name.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;scanf(&quot;%d&quot;,&amp;amp;age);&lt;/i&gt;&lt;/b&gt; //reading an integer value;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;scanf(&quot;%f&quot;,&amp;amp;avg);&lt;/i&gt;&lt;/b&gt;//reading a float value;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;scanf(&quot;%c%d&quot;,&amp;amp;grade,&amp;amp;roll);&lt;/i&gt;&lt;/b&gt; //reading a character and an integer.&lt;br /&gt;
&lt;b&gt;&lt;i&gt;scanf(&quot;%d%d%d%d%d&quot;,&amp;amp;m1,&amp;amp;m2,&amp;amp;m3,&amp;amp;m4,&amp;amp;m5);&lt;/i&gt;&lt;/b&gt;//reading 5 integers.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;Learning by Example 2&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
/* Program to read two numbers and find their sum */&lt;br /&gt;
&lt;pre&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
main( )
{
int a,b,sum; /* declare three integer variables */
clrscr( );
printf(&quot;Enter two numbers : &quot;); /* Prompt the user to enter two numbers */
scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b); /* Read two integers from keyboard values in a and b */
sum=a+b; /* add a and b, store result in sum */
printf(&quot;Sum=%d&quot;,sum); /* Print the value in sum */
/*printf(&quot;%d+%d=%d,a,b,sum); */ /* Try using this to print sum*/
getch( );
}
&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;int a,b,sum;&lt;/i&gt;&lt;/b&gt; will declare three integer variables a,b,sum each variable will get 2 bytes memory space allocated, a,b and sum now may contain some garbage values.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;Next we are prompting the user to enter two numbers using the &lt;b&gt;&lt;i&gt;printf( )&lt;/i&gt;&lt;/b&gt;, it is necessary in our programs to instruct the user what to do next, or what to do from his side for program execution.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;While executing &lt;i&gt;&lt;b&gt;scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b);&lt;/b&gt;&lt;/i&gt; the control will wait for two values from keyboard, input two numbers and that numbers will be stored in the variable a and b.  Here first number will be stored in variable &#39;a&#39; and second will be in variable &#39;b&#39;.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;sum=a+b;&lt;/i&gt;&lt;/b&gt; will add the values within &#39;a&#39; and &#39;b&#39; and assignment operator (=) will assign the value thus results to the variable &#39;sum&#39;.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;i&gt;&lt;b&gt;printf(&quot;Sum=%d&quot;,sum)&lt;/b&gt;&lt;/i&gt;; will print the sum in the format &lt;i&gt;&lt;b&gt;Sum=250 &lt;/b&gt;&lt;/i&gt;(If we input two number 175 and 75).&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2010/03/variables-constants-keywords-datatypes.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/08/sample-c-programs.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/7652811882612687604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/08/reading-data-from-keyboard.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/7652811882612687604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/7652811882612687604'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/08/reading-data-from-keyboard.html' title='Reading Data from the Keyboard'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-9075372901411657387</id><published>2009-08-03T12:16:00.000-07:00</published><updated>2010-03-25T02:13:01.199-07:00</updated><title type='text'>Variables, Constants, Keywords &amp; Datatypes</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;All programs deal with some sort of data, a program accepts some data from the user and manipulates it and provide the manipulated/processed data - the information.  We may use different kinds of data in our programs, it may be a constant value, or a varying type known as variable.  The type of data&#39;s used may be different, for example in a mark list preparing program the datas may include student_name,subject,mark,roll_no,avg etc., student_name is a data which uses some characters to form a student name, roll_no represents student&#39;s roll number and it may be a number-an integer.  Likewise avg may be a decimal value.  So we are dealing with different kinds of data.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;Constants&lt;/i&gt;&lt;/b&gt; are data value which is predefined before a program is used.  Values remain unchanged during the program execution.  For example &quot;C Program&quot; is a string constant.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;Variables&lt;/i&gt;&lt;/b&gt; are identifiers which we used to represent or identify a data.  Variables are varying type values.  Here the data may change or be assigned different values as the program runs.  For example &lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;emp_salary=12000; (emp_salary is a variable which holds the value 12000)&lt;br /&gt;
emp_salary=12500; (now emp_salary contains the value 12500)&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;There are some rules when using variable names.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Rules of naming variables&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;1.  Variable name should only contain alphabets (a-z,A-z), digits(0-9) and underscore(_).&lt;br /&gt;
2.  Variable name must start with an alphabet or an underscore.&lt;br /&gt;
3.  Variable name should not contain any blank space.&lt;br /&gt;
4.  Pre defined words in C (known as Keywords) cannot be used as a variable name.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;i&gt;Care should be taken while program in C as keywords or variables used in C are case sensitive.&lt;/i&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;Keywords are the basic constructs used to write a program.  Keywords have a predefined meaning in C.  For example &lt;b&gt;&lt;i&gt;int&lt;/i&gt;&lt;/b&gt; is a keyword used to declare an integer variable.  Keywords cannot be used as a variable/function name.&lt;br /&gt;
&lt;br /&gt;
Variables are used to represent a data in a program, each data may be of different type, age data may be a numeric type(integer). Grade of a student can be a character.  So all variables used in a C program must be declared to the appropriate type before we use those variables.  Each variables thus declared possess some space of memory to hold the value it represents.  In C data types can be divided as Primary and Secondary(Derived).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Primary Data types&lt;/i&gt;&lt;/b&gt; : int, char, float, double. &lt;i&gt;&lt;b&gt;int &lt;/b&gt;&lt;/i&gt;data type can be used to represent an integer value, &lt;i&gt;&lt;b&gt;char&lt;/b&gt;&lt;/i&gt; data type is used to represent a single character, &lt;i&gt;&lt;b&gt;float&lt;/b&gt;&lt;/i&gt;  data type is used to store a decimal value, &lt;i&gt;&lt;b&gt;double&lt;/b&gt;&lt;/i&gt; data type is used to declare a double precision floating point.  Each type have a range of values that it can hold, and each type allocates a specific byte of memory for the value.&lt;/div&gt;&lt;br /&gt;
1. &lt;b&gt;&lt;i&gt;int&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
Range : -32768 to +32767&lt;br /&gt;
Memory : 2 bytes&lt;br /&gt;
Control String : %d&lt;br /&gt;
&lt;br /&gt;
2. &lt;b&gt;&lt;i&gt;char&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
Range : -128 to +127&lt;br /&gt;
Memory : 1 byte&lt;br /&gt;
Control String : %c&lt;br /&gt;
&lt;br /&gt;
3. &lt;b&gt;&lt;i&gt;float&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
Range : 3.4e-38 to 3.4e+38&lt;br /&gt;
Memory : 4 bytes&lt;br /&gt;
Control String : %f&lt;br /&gt;
&lt;br /&gt;
4. &lt;b&gt;&lt;i&gt;double&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
Range : 1.4e-308 to 1.4e+308&lt;br /&gt;
Memory : 8 bytes&lt;br /&gt;
Control String : %lf&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;int&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt; data type allocates 2 bytes to store an integer number.  A variable declared as &lt;b&gt;&lt;i&gt;int&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt; can hold an integer value in the range of -32768 to +32767.  If you want to store an integer above this range instead of &lt;b&gt;&lt;i&gt;int&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt; you may use &lt;b&gt;&lt;i&gt;long int&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt;, control string of &lt;b&gt;&lt;i&gt;long int&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt; is &lt;b&gt;&lt;i&gt;%ld&lt;/i&gt;&lt;/b&gt;.  Control string is associated with C data types and you are required to use appropriate control string with each variable used in your program while you read a data to the variable or print a data in variable.  Control string enables the format of data in the variable.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Secondary Data types&lt;/i&gt;&lt;/b&gt; can be created from the existing data types.  It includes arrays, structures, unions, enums, linked lists, pointers etc.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Declaring a Variable&lt;/b&gt; : You can declare a variable by specifying the data type of that variable.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Syntax&lt;/i&gt; : &amp;lt;datatype&amp;gt; &amp;lt;variable_name&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;int age&lt;/i&gt;&lt;/b&gt;; /*Declare an integer variable age.*/&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;float avg,mark;&lt;/b&gt;&lt;/i&gt;&lt;b&gt; &lt;/b&gt;/*2 variables are declared.  4 bytes allocated to each variable, and can store any values which falls in the float range.*/&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;float avg;&lt;/i&gt;&lt;/b&gt; /*variable avg is declared*/&lt;br /&gt;
&lt;b&gt;&lt;i&gt;avg=98.74;&lt;/i&gt;&lt;/b&gt;/*avg is initialized with value 98.74*/&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;char ch=&#39;A&#39;;&lt;/i&gt;&lt;/b&gt; /*a character variable ch is declared with the value A.*/&lt;br /&gt;
&lt;br /&gt;
So now have a look at the program with some variables&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;/*Program to print variable values */
#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
main( )
{
int num=850;
float avg=98.54;
double dblval;
char ch=&#39;S&#39;;
dblval=99745.5684;
clrscr( );
printf(&quot;Character ch=%c&quot;,ch);
printf(&quot;\nInteger num=%d&quot;,num);
printf(&quot;\nFloat avg=%c&quot;,avg);
printf(&quot;\nDouble dblval=%lf&quot;,dblval);
/*printf(&quot;ch=%c\nnum=%d\navg=%f\ndblval=%f&quot;,ch,num,avg,dblval);*/
getch( );
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/07/compiling-and-running-your-program.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/08/reading-data-from-keyboard.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/9075372901411657387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2010/03/variables-constants-keywords-datatypes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/9075372901411657387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/9075372901411657387'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2010/03/variables-constants-keywords-datatypes.html' title='Variables, Constants, Keywords &amp; Datatypes'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-4697014407346044779</id><published>2009-07-30T11:44:00.000-07:00</published><updated>2010-03-25T01:58:27.735-07:00</updated><title type='text'>Compiling and Running your program</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;So far we have discussed about C, features of C, structure of a C program, library function printf( ) and how to program in C language etc. So now we are moving into more detailed explanation. You can use Turbo C or Borland C compilers for your program. Both are providing you a way to code your program, compile it and execute the program. If you are using &#39;Borland C&#39; then linking header files is necessary. Turbo C won&#39;t warn if you are not linked header files into your program. So now we can see a sample program as a step to explore the power of C language. So open your C editor (Turbo or Borland) and start coding.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-style: italic; font-weight: bold;&quot;&gt;Learning by Example I&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Qn: A Program to print your Name on the Screen&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;pre&gt;/*Program to print name on the screen */
#include&amp;lt;stdio.h&amp;gt;
main( )
{
printf(&quot;Your Name&quot;);
}
&lt;/pre&gt;&lt;br /&gt;
So you&#39;ve done! Now you can compile your program to convert it into object code. For that select Compile - &amp;gt; Compile; then a compiling box will be displayed on the screen showing file name, lines compiled, number of warnings &amp;amp; errors if any in the program. If your program has successfully compiled then you can turn into execute or run the program. If there are any errors in the program, number of errors will be displayed on the compiling window and when you hit &#39;Enter&#39; key, details of the errors listed in the message window; select the error message using up/down arrow keys and hit &#39;Enter&#39; key to locate the error instruction, correct the errors and compile it.&lt;br /&gt;
&lt;br /&gt;
For executing the program select Run-&amp;gt;Run from the menu. You r editor will suddenly blink and return back to the editor window where you&#39;ve coded your program. So your program has been executed, you can view the output of the program by pressing Alt+F5 keys. You can now see &#39;Your name&#39; (whatever given in printf) printed on the screen. Ok, now lets have a look at our code:&lt;br /&gt;
&lt;br /&gt;
We have written a comment line on the first line. In link section we linked header file &lt;stdio.h&gt;as we&#39;ve used printf( ) function in our program. As we discussed already, printf( ) is a function which means which is already coded and stored in the C library. Instructions for printf( ) function is written in a header files ( having extension .h) &#39;stdio.h&#39;. stdio means Standard Input and Output. So if you are using any of the library function in your program, you should link appropriate header file into your program.&lt;br /&gt;
&lt;br /&gt;
If you again run your program, output will be displayed on the screen with the old program output. So you may be want to print your outputs on a clean window, you can clear your screen before you are printing any output. For this you can use a library function &#39;clrscr( )&#39;. Just put this function in your program where you want to clear your screen. clrscr( ) function&#39;s header file is &lt;conio.h&gt;, so do link this header file into your program. In our program you can insert clrscr( ) just before that printf( ) function; Run your program again and you will see your name printed in a cleared screen.&lt;br /&gt;
&lt;br /&gt;
It may be disturbing everytime pressing Alt+F5 keys to view the output. Why we are redirected to the editor window after program run? Because process control executes each line of instructions and when comes out of the closing brace, program terminates and get back to the coding window. You can pause the program termination by just putting getch( ) function just before the closing brace. getch( ) is actually a function which accepts a value from the keyboard. So if you insert a getch( ) function as your last instruction, the program control will wait for a value to be inputted to the getch( ); so till entering a value, you can view your program outputs on the screen. By this you can avoid the usage of hitting Alt+F5.&lt;br /&gt;
&lt;br /&gt;
So from the above modification our program will be look as follows:&lt;br /&gt;
&lt;/conio.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;
&lt;pre&gt;/*Program to print name on the screen */
#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
main( )
{
clrscr( );
printf(&quot;Your Name&quot;);
getch( );
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/07/c-program-basics.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2010/03/variables-constants-keywords-datatypes.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/4697014407346044779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/07/compiling-and-running-your-program.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/4697014407346044779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/4697014407346044779'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/07/compiling-and-running-your-program.html' title='Compiling and Running your program'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-2261274680136635464</id><published>2009-07-29T11:41:00.000-07:00</published><updated>2010-03-25T01:55:13.406-07:00</updated><title type='text'>C PROGRAM BASICS</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;&lt;pre&gt;main( )
{ /* This is the beginning */
printf(&quot;Welcome to the world of C&quot;);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;The first line informs the system that the name of the program is main( ) and the execution begins at this line. The main( ) is a special function used by the C system to tell the computer where the program starts. Every C program must have exactly one main( ) function. If we use more than one main( ), the compiler cannot tell wich one marks the begining of program. The empty parenthesis immediately following the &lt;span style=&quot;font-style: italic;&quot;&gt;main&lt;/span&gt; indicates that the function &lt;span style=&quot;font-style: italic;&quot;&gt;main&lt;/span&gt; has no arguments. The opening brace { in the second line marks the begining of the function main( ) and the closing brace } in the last line indicates the end of the function. All the statements between these two statements form the function body. The function body contains a set of instructions to perform a given task.&lt;br /&gt;
&lt;br /&gt;
In this case the function body contains two statements out of which the&lt;span style=&quot;font-style: italic;&quot;&gt; printf&lt;/span&gt; line is an executable statement. The lines begin with /* and ends with */ is known as &#39;comment line&#39;. Comment lines are non-executable statements and therefore anything between /* and */ is ignored by the compiler.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-style: italic;&quot;&gt;printf&lt;/span&gt; is a predefined standard function for printing output. Predefined means it is a function that has already been written and linked together with our program at the time of linking. The &lt;span style=&quot;font-style: italic;&quot;&gt;printf&lt;/span&gt; function causes every thing between the starting and ending quotation marks to be printed out.&lt;br /&gt;
&lt;br /&gt;
printf(&quot;Hello Guest\nWelcome to Program Logic&quot;);&lt;br /&gt;
&lt;br /&gt;
The argument in the &lt;span style=&quot;font-style: italic;&quot;&gt;printf&lt;/span&gt; contains a combination of two characters &#39;\n&#39;. This combination is collectively called the &#39;new line character&#39;. It causes the computer to go to the next line. Hence the above &lt;span style=&quot;font-style: italic;&quot;&gt;printf&lt;/span&gt; statement will output :&lt;br /&gt;
&lt;br /&gt;
Hello Guest&lt;br /&gt;
Welcome to Program Logic&lt;br /&gt;
&lt;h4&gt;Basic Structure of a C Program&lt;/h4&gt;Documentation section&lt;br /&gt;
Link section (Header File inclusion section)&lt;br /&gt;
Definition section&lt;br /&gt;
Global declaration section&lt;br /&gt;
main ( ) function section&lt;br /&gt;
{&lt;br /&gt;
Declaration part&lt;br /&gt;
Execution part&lt;br /&gt;
}&lt;br /&gt;
Subroutines&lt;br /&gt;
&lt;br /&gt;
The documentation section consist of a set of comment lines giving the name of the program and other details.&lt;br /&gt;
&lt;br /&gt;
The link section provides instruction to link functions from system library.&lt;br /&gt;
&lt;br /&gt;
The definition section defines all symbolic constants.&lt;br /&gt;
&lt;br /&gt;
There are some variables that are used in more than one function, such variables are called global variables and are declared in the global declaration section outside of all the functions.&lt;br /&gt;
&lt;br /&gt;
Every C program must have one main( ) function. This section contains two parts, declaration part and execution part. Declaration part declares all the variables used in the executable part. These two parts must appear between the opening and the closing braces. The program execution begins at the opening brace and ends at the closing brace. The closing brace of the main( ) is the logical end of the program.&lt;br /&gt;
&lt;br /&gt;
The subroutine section contains all the user defined function that are called in the main( ) function. &lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/07/overview-of-c.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/07/compiling-and-running-your-program.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/2261274680136635464/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/07/c-program-basics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/2261274680136635464'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/2261274680136635464'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/07/c-program-basics.html' title='C PROGRAM BASICS'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-8229096675360688331</id><published>2009-07-28T11:37:00.000-07:00</published><updated>2010-03-25T01:48:20.633-07:00</updated><title type='text'>OVERVIEW OF C</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;The programming language C was an offspring of the Basic Combined Programming Language (BCPL) called &#39;B&#39;. B language was modified by Dennies Ritchie and was implemented at AT &amp;amp; T Bell Laboratories in 1972. The new language was named C. Since it was developed along with the Unix Operating System it is strongly associated with Unix. This OS was coded almost entirely in C.&lt;br /&gt;
&lt;br /&gt;
The increasing popularity of C is probably due to its many desirable qualities. It is a language whose rich set of built in functions and operators can be used to write any complex program. The C compilers combines the capabilities of an assembly language with the features of a high level language and therefore it is well suited for writing both system software and business packages.&lt;br /&gt;
&lt;br /&gt;
Programs written in C are efficient and fast this is due to its variety of data types and powerful operators. There are only 32 keywords and a strength lies in its built in function. C is highly portable. This means that C programs written for one computer can be run on another with little or no modification.&lt;br /&gt;
&lt;br /&gt;
Another important feature of C is its ability to extend itself. A &#39;C &#39; program is basically a collection of function that are supported by the C library. We continuously add our own functions to the C library.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/07/computer-program.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/07/c-program-basics.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/8229096675360688331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/07/overview-of-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/8229096675360688331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/8229096675360688331'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/07/overview-of-c.html' title='OVERVIEW OF C'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-5621020315212146831</id><published>2009-07-19T11:17:00.000-07:00</published><updated>2010-03-25T01:46:28.995-07:00</updated><title type='text'>COMPUTER PROGRAM</title><content type='html'>A computer program is a set of instructions to be followed by the computer.  These instructions are the steps to be followed sequentially in order to achieve the result.&lt;br /&gt;
&lt;h4&gt;&lt;u&gt;CHARACTERISTICS OF A GOOD PROGRAM&lt;/u&gt;&lt;/h4&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;1. Accuracy&lt;/span&gt; : The program must do what it is supposed to do and meet the critical laid down in its specification.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;2. Reliability&lt;/span&gt; : The program must always do what it is supposed to do and never crash.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;3. Efficiency&lt;/span&gt; : The program must use the available store space and resources in such a way that the system speed is not waste.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;4. Robustness&lt;/span&gt; : The program should cope with invalid data without stopping with no indication to the cause and without creating errors.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;5. Usability&lt;/span&gt; : The program must be easy to use and well documented.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;6. Maintainability&lt;/span&gt; : The program must be easy to amend having good structuring and documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;7. Readability&lt;/span&gt; : The code in the program must be well laid out and explained with comments.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;8. Portability&lt;/span&gt; : It should be seen that the program is easy to transfer to other machines as well.&lt;br /&gt;
&lt;h4&gt;&lt;u&gt;TYPES OF DATA&lt;/u&gt;&lt;/h4&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Constants&lt;/span&gt; : This is the data which is predetermined before a program is used.  Values remain unchanged during the execution of a program.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Variables&lt;/span&gt; : Here the data may change or be assigned different values as the program runs.&lt;br /&gt;
&lt;h4&gt;&lt;u&gt;OP CODE &amp;amp; OPERAND&lt;/u&gt;&lt;/h4&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A Machine language instruction normally has a two part format.  The first part is an instruction , is the operation code, that tells the computer what function to perform, and the second one is operand, that tells the computer where to find or store the data or other instructions that are to be manipulated.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;All programming languages has its own syntax, rules or grammar.  So we should follow the syntax of the programming language in which we are programming.  Breaking any of these will cause bugs or Errors in our program.&lt;/span&gt;&lt;/div&gt;&lt;h4&gt;&lt;u&gt;Logic, Run time &amp;amp; Syntax Errors&lt;/u&gt;&lt;/h4&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Syntax Errors&lt;/span&gt; arises due to the lack of knowledge in the programming language syntax.  It arises because of the error in the syntax of programming instructions.  Programs having syntax errors cannot be compiled or executed.  Compilers will show syntax errors in the program specifying the line number and information about the error.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Logic Errors&lt;/span&gt; are another kind of error and causes because of the faulty or bad logic of the programmer.   It may result in the programs functionality and often produce undesired output.  For example instead of adding two numbers like a+b, programmer coded like a-b; Programmer used a-b instead of instruction a+b.  This type of errors cannot be detected by compilers because instructions may be valid (both a+b and a-b are valid instructions) but it has some logic errors and the program will results undesired or unpredictable result.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Run time Errors&lt;/span&gt; are errors occur when a program executes.  Compilers cannot predict the run time errors in the program.  Its arises only when a program runs.  eg. Division by Zero Error.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2010/03/algorithms.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/07/overview-of-c.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/5621020315212146831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2009/07/computer-program.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/5621020315212146831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/5621020315212146831'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2009/07/computer-program.html' title='COMPUTER PROGRAM'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/s72-c/Previous.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-5549681405899221109</id><published>2009-07-01T10:58:00.000-07:00</published><updated>2010-03-25T01:45:11.048-07:00</updated><title type='text'>ALGORITHMS</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;An Algorithm is a sequence of finite instructions or steps used to complete a task or a problem. There is no generally accepted rule for algorithms, its a sequence of steps carried out to complete a task. But if we are considering computer programs, we need somewhat a standardized format for Algorithms, that means Algorithms are an aid for programs, so there should be a definite start and an end for the algorithm.&lt;br /&gt;
&lt;br /&gt;
Algorithms can be expressed in different notations, including natural languages, Pseudo codes, flow charts etc. Flow Charts and Pseudo Codes are widely used for Technical and Complex algorithms. and are used in the structured program designs. Natural language expressions cannot be used as its may make ambiguity.&lt;/div&gt;&lt;h4&gt;FLOWCHARTS&lt;/h4&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;A Flowchart is a pictorial representation of an Algorithm or a Process, showing each steps in various kinds of boxes in order, and connecting these boxes with arrows.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;Flowchart is the representation of the programming steps. It shows the various steps in sequence which are needed to run the program. Flowchart uses boxes of different shapes to denote different types of instructions. The instructions are written within these boxes using clear and concise statements. These boxes are connected by solid lines having arrow marks to indicate the flow of operations that is the exact sequence in which the instructions are to be executed. Flowchart helps in detecting errors in the program logic also. Once the flowchart is ready, the programmer can concentrate only on coding the operations in each box of the flowchart in terms of the statements of the programming language. This usually ensure an error-free program.&lt;/div&gt;&lt;h4&gt;Flow Chart Symbols&lt;/h4&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX8lwz4I0sYLAshzbnko704zvSGRbZtnBsqJQzcVpdq4ZEP9E3aXj8vTh8aTkwtZeUQwOyGc5y_nA924SmPH8bLUnM0QN4KiCoePYojDAihhZJurl3L8aMIujV-93eBCajmwM8SvT7qcE/s1600-h/flow-chart-symbols.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5286967412674129890&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX8lwz4I0sYLAshzbnko704zvSGRbZtnBsqJQzcVpdq4ZEP9E3aXj8vTh8aTkwtZeUQwOyGc5y_nA924SmPH8bLUnM0QN4KiCoePYojDAihhZJurl3L8aMIujV-93eBCajmwM8SvT7qcE/s400/flow-chart-symbols.png&quot; style=&quot;cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 288px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h4&gt;Symbols&lt;/h4&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A typical flowchart from older Computer Science textbooks may have the following kinds of symbols:&lt;br /&gt;
&lt;dl&gt;&lt;dt style=&quot;font-weight: bold;&quot;&gt;Start and end symbols &lt;/dt&gt;
&lt;dd&gt;Represented as lozenges, ovals or rounded rectangles, usually containing the word &quot;Start&quot; or &quot;End&quot;, or another phrase signaling the start or end of a process, such as &quot;submit enquiry&quot; or &quot;receive product&quot;. &lt;/dd&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt style=&quot;font-weight: bold;&quot;&gt;Arrows &lt;/dt&gt;
&lt;dd&gt;Showing what&#39;s called &quot;flow of control&quot; in computer science. An arrow coming from one symbol and ending at another symbol represents that control passes to the symbol the arrow points to. &lt;/dd&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt style=&quot;font-weight: bold;&quot;&gt;Processing steps &lt;/dt&gt;
&lt;dd&gt;Represented as rectangles. Examples: &quot;Add 1 to X&quot;; &quot;replace identified part&quot;; &quot;save changes&quot; or similar. &lt;/dd&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt style=&quot;font-weight: bold;&quot;&gt;Input/Output &lt;/dt&gt;
&lt;dd&gt;Represented as a parallelogram. Examples: Get X from the user; display X. &lt;/dd&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt style=&quot;font-weight: bold;&quot;&gt;Conditional or decision &lt;/dt&gt;
&lt;dd&gt;Represented as a diamond (rhombus). These typically contain a Yes/No question or True/False test. This symbol is unique in that it has two arrows coming out of it, usually from the bottom point and right point, one corresponding to Yes or True, and one corresponding to No or False. The arrows should always be labeled. More than two arrows can be used, but this is normally a clear indicator that a complex decision is being taken, in which case it may need to be broken-down further, or replaced with the &quot;pre-defined process&quot; symbol. &lt;/dd&gt;
&lt;dt&gt;&lt;br /&gt;
&lt;/dt&gt;
&lt;dt style=&quot;font-weight: bold;&quot;&gt;Connectors&lt;br /&gt;
&lt;/dt&gt;
&lt;dd&gt;There are instances when a flowchart becomes too large to fit in a single page and the use of flow lines becomes impossible. In such situations awe use the connector symbols as as substitute for flow lines.&lt;/dd&gt;&lt;/dl&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;Sample Flowchart to find the sum of first 50 natural numbers&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8JXQabgsnd6HrlqWVZHPOMDec7k4Lofi5nGHplndWkUHaRENew_oK31p9J7PZPw4a0Lb6MP7n966nFsdt-ae7v19hWAkeTVccC2XAiCxlOIdJf0PABgXmNuoeOPzfZhmslT0sH32RD5E/s1600-h/Sum%20of%20first%2050%20natural%20numbers.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5286970068803204050&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8JXQabgsnd6HrlqWVZHPOMDec7k4Lofi5nGHplndWkUHaRENew_oK31p9J7PZPw4a0Lb6MP7n966nFsdt-ae7v19hWAkeTVccC2XAiCxlOIdJf0PABgXmNuoeOPzfZhmslT0sH32RD5E/s400/Sum%2520of%2520first%252050%2520natural%2520numbers.png&quot; style=&quot;cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 289px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-style: italic; font-weight: bold;&quot;&gt;Finding Largest among three input numbers&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmBQUcg7lD8CO5ezyAxeUZjOydRqW5XWd2SrVeSytDjSr3UqKCLA7UtpU42CmXt1cQOrAv52rBAqTVTXedtO1EYRmUU2hdzY9CFIinvrRJQ2aNVhBUF6-EYRlNXo44BEJmJHGLjEyE7Vo/s1600-h/Flowchart%20for%20finding%20out%20the%20largest%20of%20three%20number.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5286970647093375858&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmBQUcg7lD8CO5ezyAxeUZjOydRqW5XWd2SrVeSytDjSr3UqKCLA7UtpU42CmXt1cQOrAv52rBAqTVTXedtO1EYRmUU2hdzY9CFIinvrRJQ2aNVhBUF6-EYRlNXo44BEJmJHGLjEyE7Vo/s400/Flowchart%2520for%2520finding%2520out%2520the%2520largest%2520of%2520three%2520number.png&quot; style=&quot;cursor: pointer; height: 332px; width: 400px;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;h4&gt;ADVANTAGES OF FLOWCHART&lt;/h4&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;1. Conveys better meaning&lt;/span&gt; : Since a flowchart is a pictorial representation of a program, it is easier for a programmer to understand and explain the logic of the program to some other programmer.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;2. Effective joining of a part of a system :&lt;/span&gt; A group of programmers are normally associated with the design of large software system. Each programmer is responsible for designing only a part of the entire system. If each programmers draws a flowchart for his part of design, the flowcharts of all the programmers can be placed together to visualize the overall system design.&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;
3. Efficient Coding :&lt;/span&gt; Once a flowchart is ready, programmers find it very easy to write the concerned program because the flowchart acts as a road map for them.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;4. Systematic Debugging :&lt;/span&gt; A flowchart is very helpful in detecting, locating and removing mistakes in a program in a systematic manner.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;5. Systematic Testing : &lt;/span&gt;Testing is the process of confirming whether a program will successfully do all the jobs for which it has been designed under the specified constraints. For testing a program different sets of data are fed as input to that program to test the different parts in the program logic.&lt;br /&gt;
&lt;h4&gt;DRAWBACKS OF FLOWCHARTS&lt;/h4&gt;&lt;ol&gt;&lt;li&gt;Flowcharts are something new and strange to work with for beginners.&lt;/li&gt;
&lt;li&gt;When modifications are made in the original program corresponding changes must be made in the flowcharts of the program in the documentation.&lt;/li&gt;
&lt;li&gt;Flowcharts may not reveal significant steps to be followed in actual coding.&lt;/li&gt;
&lt;li&gt;Flowcharts are often cumbersome to use and costly to produce.&lt;/li&gt;
&lt;li&gt;Flowchart don&#39;t constitutes a programming language. They are person to person means of communication, not person to computer.&lt;span style=&quot;font-weight: bold;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;h4&gt;PSEUDO CODE [STRUCTURED ENGLISH]&lt;/h4&gt;PSEUDO CODE is another program analysis tool that is used for planning program logic &#39;pseudo&#39; means imitation and code refers to the instructions written in a programming language. Pseudo code is therefore an imitation of actual computer instructions. These pseudo instructions are phrases written in ordinary natural language.&lt;br /&gt;
&lt;br /&gt;
Instead of using symbols to describe the logic steps of a program as in a flow charting, pseudo code uses a structure that resembles computer instructions. Because it emphasizes the design of the program. Pseudo code is also called Program Design Language [ PDL]. Pseudo code is made up of the following basic logic structures.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Sequence&lt;/li&gt;
&lt;li&gt;Selection [if....then....else, if...then]&lt;/li&gt;
&lt;li&gt;Iteration [ do...while,Repeat...until]&lt;/li&gt;
&lt;/ol&gt;A sequence structure is a single step or action included in a process. It does not depend n the existence of any condition and when encountered it is always executed. Eg: To purchase a book in a book store you would probably follow a procedure similar to the one that follows&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;a. Pick out a desirable book&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;b. Take the book to the checkout counter&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;c. Pay for the book&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;d. Obtain receipt&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;e. Leave the store&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Selection logic also known as decision logic, is used for making decisions. It is used for selecting the proper path out of the two or more alternative paths in the program logic. Selection logic is depicted as either an if.. then... else or if... then structure.&lt;br /&gt;
&lt;br /&gt;
Iteration logic is used when one or more instructions may be executed several times depending on some conditions. It used two structures called the Do while and repeat until. Both these structures are used for looping. &lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2008/07/introduction-to-computer-programming.html&quot;&gt;&lt;img alt=&quot;Previous&quot; src=&quot;http://lh5.ggpht.com/_d9q_4MqWMvM/SryIwR5HJfI/AAAAAAAAAMs/QK98BvRIsXY/Previous.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2009/07/computer-program.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/5549681405899221109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2010/03/algorithms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/5549681405899221109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/5549681405899221109'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2010/03/algorithms.html' title='ALGORITHMS'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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/AVvXsEgX8lwz4I0sYLAshzbnko704zvSGRbZtnBsqJQzcVpdq4ZEP9E3aXj8vTh8aTkwtZeUQwOyGc5y_nA924SmPH8bLUnM0QN4KiCoePYojDAihhZJurl3L8aMIujV-93eBCajmwM8SvT7qcE/s72-c/flow-chart-symbols.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8399007682609351165.post-489863462512780458</id><published>2009-07-01T10:26:00.000-07:00</published><updated>2010-03-25T01:43:53.365-07:00</updated><title type='text'>INTRODUCTION TO COMPUTER PROGRAMMING</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;A computer program is a collection of instructions that describe a task, or set of tasks, to be carried out by a computer. We can instruct a human being to do a particular task by speaking up or through any other media. As computers are bare machines we have to instruct them using some languages that are understood by the computer. For this purpose, communicating with the computer for instructing them to do a particular task we use special languages called &#39;Programming Languages&#39;. The task of instructing the machines using programming languages is called &#39;Programming&quot;. Those persons who deals with the programming is known as &#39;Computer Programmers&#39;.&lt;/div&gt;&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;We can classify the programming languages into two broad categories. &lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Low Level Languages&lt;/li&gt;
&lt;li&gt;High Level Languages&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;b&gt;1. Low Level Languages : &lt;/b&gt;Low Level languages are of two types :-&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;Machine Languages&lt;/b&gt; and &lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Assembly Languages.&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Machine Language:&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;As computers are electronic devices, they internally represents all data as binary 1 and 0. a binary 0 may be used to represent power off or low voltage whereas 1 may represent high voltage or power on state. Using machine language, programmer programs in computer&#39;s own language, that is binary language. A programmer programming in machine language deals with binary 0&#39;s and 1&#39;s. In machine all instructions are represented as combination&#39;s of binary 0&#39;s and 1&#39;s. The memory addresses for the data also be specified in the program. Hence an instruction such as a+b, should be in binary language, there may be corresponding binary combination&#39;s for each operator and operands, addresses for operands should be specified in the program. Hence programming in machine language is not an easy task. The limitation of machine language programming are : - &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Difficult to program&lt;/li&gt;
&lt;li&gt;Difficult to modify&lt;/li&gt;
&lt;li&gt;Error prone&lt;/li&gt;
&lt;li&gt;Machine Dependent (No Portability) : Programs written in machine  language are not portable, which means we cannot copy it into another  machine and use. &lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;The main advantage of machine language is that, programs written in machine language can be fastly executed, because there&#39;s no need to convert the program into machine&#39;s code, its already in binary language.&lt;/div&gt;&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Assembly Language:&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;Assembly Language is also known as Symbolic language. In assembly language, we can program using symbols and alphabets. The following are the limitations of Assembly Language : - &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Machine Dependent.&lt;/li&gt;
&lt;li&gt;Deep knowledge in hardware required by the programmer.&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;Assembly language programs can be written using symbols and digits, as computer internally represent all data in binary form, an assembly program must be translated into equivalent machine code before executing the program. This translation is done by a translation program known as Assembler.&lt;/div&gt;&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;&lt;b&gt;2. High Level Languages &lt;/b&gt;are user friendly languages; using which anybody having a little knowledge of programming language can program without bothering about internal structure or memory addresses. Examples of high level languages are: COBOL, BASIC, C, C++, JAVA, PYTHON etc. Programs written in high level languages can be easily ported to any other system with a little or no modification.&lt;/div&gt;&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;Programs written in high level languages such as C, C++ etc. are cannot directly understand by the computer, so they have to translated into machine code, and this translation is done by Compilers or Interpreters.&lt;/div&gt;&lt;br /&gt;
&lt;div align=&quot;right&quot; style=&quot;float: right;&quot;&gt;&lt;a href=&quot;http://coursezone.blogspot.com/2010/03/algorithms.html&quot;&gt;&lt;img alt=&quot;Next&quot; src=&quot;http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/Next.png&quot; style=&quot;border: medium none;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coursezone.blogspot.com/feeds/489863462512780458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coursezone.blogspot.com/2008/07/introduction-to-computer-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/489863462512780458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8399007682609351165/posts/default/489863462512780458'/><link rel='alternate' type='text/html' href='http://coursezone.blogspot.com/2008/07/introduction-to-computer-programming.html' title='INTRODUCTION TO COMPUTER PROGRAMMING'/><author><name>Ragesh</name><uri>http://www.blogger.com/profile/18313564744258327924</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="http://lh6.ggpht.com/_d9q_4MqWMvM/SryIwWbs78I/AAAAAAAAAMo/TqzASAg99eA/s72-c/Next.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>