Statement in c - Statement in c Statement is a part of our program that can be executed In other words every statement in our program alone or in

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Statement is a part of our program that can be executed. In other words every statement in our program  alone or in combination specifies an action to performed by our program. C provides variety of statements. One of the reason for popularity of C is because of the extreme power  provided to programmer in C due to it rich and diverse set of statements define in C. Types Of Statements Statements in C are categorized into following types- 1.Conditional Statement:  its also called a selection statement. this statement depends on the condition.  that decide the flow of statements based on evaluation of the results of condition. if - else and switch  statements always come in conditional statements. if-else   :   if - else  is a conditional statements. that always depend on condition.  if  statement have a some  condition (true or false), that is given by the program .if the  if  condition will not be true than it will read the  else  statement and execute the  else  statement and go to the next line of the program for execution. if the  if  statement is true than it execute the  if  statement and it  will not read the  else  statement and go to next  line of the program for execution.  General form of if-else statement-             if (condition) statement;                     else statement; OR                if ( condition ) {                 expresion1;                  }                 else  {                  expresion2;                } Example-   #include <stdio.h>         int  main () {          int  a , b ;         printf ( "Enter value for a :" );         scanf ( "%d" a );         printf ( "Enter value for b:" );         scanf ( "%d" b );          if   (  a  >  b  ) {                 printf ( "a is large number - %d \n " , a );          }          else {                 printf ( "b is large number - %d \n " , b );         
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/04/2012 for the course ECON 201 taught by Professor Profatera during the Spring '11 term at Albany Medical College.

Page1 / 6

Statement in c - Statement in c Statement is a part of our program that can be executed In other words every statement in our program alone or in

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online