Skip to main content
If-else-If Statement
C language support if-else-if statement to test additional conditions. The if-else-if construct works in the same way as a normal if statement. If-else-If statement is an extension of if else statement. It specifies "if some condition is true then execute some task; Otherwise if some other condition is true,then execute some different task; If none condition are true then execute some default task.
Write a program to display the Examination result
#include <stdio.h>
#include<conio.h>
void main()
{
int marks;
printf("\n Enter the marks obtained: ");
scanf("%d", &marks);
if(marks>=75)
{
printf("\n DISTINCTION");
{
else if(marks>=60 && marks <75)
{
printf("\n FIRST DIVISION");
{
else if(marks>= 50 && marks <50)
{
printf("\n SECOND DIVISION");
}
else if(marks>=40 && marks <50)
{
printf("\n THIRD DIVISION");
{
else
{
printf("\n FAIL");
}
getch();
}
Output
Enter the marks obtained:
55
SECOND DIVISION
Comments
Post a Comment