Conditional Statements & Branching: Ce143: Computer Concepts & Programming
Conditional Statements & Branching: Ce143: Computer Concepts & Programming
Chapter - 5
Consider the fact that you and some of your friends have
planed to go out for a holiday trip after the Semester.
You have also decided that if you have got received money
10,000 Rupees or more from your parent then you will go
out for a foreign trip.
Otherwise, if the allotted money is less than 10,000 then you
will go out for a country side trip.
Now you are supposed to design a program to solve this
problem.
if (test_condition)
{
statement-block;
}
statement x;
void main()
{
int number = 0;
printf("\nEnter an integer between 1 and 10: ");
scanf("%d",&number);
if (number > 7)
printf("You entered %d which is greater than 7\n", number);
if (number < 3)
printf("You entered %d which is less than 3\n", number);
}
It is equivalent to:
if(x<0)
flag=0;
else
flag=1;
Syntax1 | Syntax2
----------------------------
goto label; | label:
. | .
. | .
. | .
label: | goto label;