Else-if ladder(Programme in c)
Else-if ladder(Programme in c)
#include<stdio.h>
#include<stdlib.h>
//start of main function
int main()
{
//variable declaration
int marks;
//get marks from user
printf("Enter your marks between 0-70: ");
scanf("%d", &marks);
//decide grade using else-if ladder and print result
if(marks >= 90)
printf("YOUR GRADE : A\n");
else if (marks >= 45 && marks < 70)
printf("YOUR GRADE : A\n");
else if (marks >= 35 && marks < 45)
printf("YOUR GRADE : B\n");
else
printf("YOUR GRADE : Failed\n");
//terminate main function and return 0 as output
return(0);
}
Comments
Post a Comment