Programming Languages/C and C++
[C Examples] GPA 계산기 예제코드: if(), else if()
Henry Cho
2023. 2. 17. 03:08
GPA 계산기 예제코드: if(), else if()
포스트 난이도: HOO_Intern
# Example Codes
#include <stdio.h>
#include <stdlib.h>
int main()
{
float gpa;
printf("Enter the GPA:\n");
scanf("%f.2", &gpa);
if (gpa > 3.9 || gpa == 3.9){
printf("Dean's list.\n");
}
else if(gpa < 2.00){
printf("GPA is below the graduation requirement.\n");
}
printf("Coded by HOO.\n");
return 0;
}
Enter the GPA:
3.9
Dean's list.
Coded by HOO.
Enter the GPA:
1.96
GPA is below the graduation requirement.
Coded by HOO.
728x90