//Program by Kumpho
#include <stdio.h>
#include "conio.h"
#include "stdlib.h"
main()
{
int score;
float gr;
char bye;
/* Generate Grede
0-49 =0
50-54=1
55-59=1.5
60-64=2
65-69=2.5
70-74=3
75-79=3.5
80-100=4
*/
do
{
printf("Program IF..THEN_ELSE to check Grade. \n============================\n");
printf("Enter your score[0-100]? :");
scanf("%d",&score);
if (score<50) gr=0;
else if (score<55) gr=1;
else if (score<60) gr=1.5;
else if (score<65) gr=2;
else if (score<70) gr=2.5;
else if (score<75) gr=3;
else if (score<80) gr=3.5;
else if (score<=100) gr=4;
else printf("Worng score!!!\n");
printf("Grade = %.2f\n",gr);
printf("\nDo you want to exit?[y]:");
bye=getch();
system("cls");
}while (bye!='y');
}
ไม่มีความเห็น