C Programming Practical 4
C Programming Practical 4
Programming Lab
Problem Definition:
Write a straight line program for finding out the grades obtained by a student
#include <stdio.h>
int main() {
int percentage;
scanf("%d", &percentage);
printf("Grade : A+");
}
printf("Grade : A");
}
printf("Grade : B");
}
printf("Grade : C");
}
else if(percentage >= 60){
printf("Grade : D");
}
else
{
printf("Grades : E\n");
printf("FAIL");
}
return 0;
}
Output :
Conclusion:
I n this practical we learnt about the use of if-else operator to obtain the desired result, i.e;
grades of the students based on their percentage.