Thinking about this, I come up with the idea of making a grade scale program which will determine if your grade is poor, satisfactory or excellent. In this program, the grades you input will be evaluated. Check out the codes below.
#include<stdio.h> #include<conio.h> main() {
float var2; printf("PASSED or FAILED??\n"); printf("Enter your grade in any subject: "); scanf("%f", &var2); printf("\nYour grade is %.2f. ", var2); if(var2==75) printf("Just enough to get you through!\n"); else if(var2<75) printf("Sorry but you have to repeat the subject!\n"); else if(var2>75 && var2<80) printf("You made it, but you have to try harder next time!\n"); else if(var2>=80) printf("It's is good. Keep it up. Congratulations!"); getch(); }
The program will ask you to enter your grade. After that, it will go through the if else statements. If your grade matches one statement then it will show you the result of the evaluation. Check out the sample output below.
Hope you learned something from this post. Feel free to leave a comment below. Thanks!
No comments:
Post a Comment
Please do leave a comment. It's gonna be a friendly conversation between programmers. Hope you do find our blog helpful. Thank you!