-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday5.c
52 lines (46 loc) · 857 Bytes
/
day5.c
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
45
46
47
48
49
50
51
52
// If else Conditionals in C Language
#include <stdio.h>
int main()
{
// Example - 1 (Simple if else)
int age;
printf("Enter your age : ");
scanf("%d", &age);
if (age >= 18)
{
printf("You can vote");
}
else
{
printf("You can not vote");
}
// Example - 2 (if else ladder)
int marks;
printf("\nEnter your marks : ");
scanf("%d", &marks);
if (marks >= 90)
{
printf("You got Grade A\n");
}
else if (marks >= 80)
{
printf("You got Grade B\n");
}
else if (marks >= 70)
{
printf("You got Grade C\n");
}
else if (marks >= 60)
{
printf("You got Grade D\n");
}
else if (marks >= 50)
{
printf("You got Grade E\n");
}
else
{
printf("You got Grade F\n");
}
return 0;
}