Source code to find the divison of student using if-else in C programming.
Saturday, August 31, 2019

//Decision making in C programming
//marks>40 pass otherwise fail
//if rain then we should have umbrella or we dont need
#include
#include
void main()
{
clrscr();
int marks; //b=30;
printf("Enter marks: ");
scanf("%d",&marks);
if(marks<40)
{
printf("A is Fail");
}
else if(marks<50)
{
printf("A is in 3rd Divison");
}
else if(marks<60)
{
printf("A is in 2nd divison");
}
else
printf("A is in 1st Divison"); getch();
}

There could be many real life problems which can be solved using if-else and if else ladder.

Examples for practice:

1. Program for calculator

2. Find largest of 3 numbers