-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnestedifelse.c
More file actions
44 lines (39 loc) · 845 Bytes
/
nestedifelse.c
File metadata and controls
44 lines (39 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
int main()
{
// Assume grade is a variable representing a student's score
int grade = 75; // You can replace this with the actual grade value
// Check if the grade is greater than or equal to 60
if (grade >= 60)
{
// If true, print "Passed"
printf("Passed\n");
} // end if
else
{
// If false, print "Failed"
printf("Failed\n");
} // end else
// Additional example with letter grades
if (grade >= 90)
{
printf("A\n");
} // end if
else if (grade >= 80)
{
printf("B\n");
} // end else if
else if (grade >= 70)
{
printf("C\n");
} // end else if
else if (grade >= 60)
{
printf("D\n");
} // end else if
else
{
printf("F\n");
} // end else
return 0;
}