-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathifelse.c
93 lines (86 loc) · 1.89 KB
/
ifelse.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include<stdio.h>
int main()
{
//conditional statements :if ,if else ,else if ,nested if,switch
// syntax of if : if(condition){ statements }
int age;
printf("enter ur age :");
scanf("%d",&age);
if( age >= 18 ) //true block
{
printf("you are ready to vote \n");
}
// ---------------------------------------------------------
// if-else syntax: if(condition){ statements }else{ statements }
// if(age>=18)
// {
// printf("you can vote !\n");
// }
// else
// {
// printf("you can't vote !\n");
// }
// ____________________________________________________
// else-if (ladder)
/* syntax:
if(condition)
{
statements
}
else if(condition2)
{
statements
}
.
.
else
{
statements
}
*/
// float marks;
// printf("enter ur marks :");
// scanf("%f",&marks);
// if(marks>=60)
// {
// printf("first division pass!\n");
// }
// else if(marks>=50)
// {
// printf("2nd division!\n");
// }
// else if(marks>=33)
// {
// printf("3rd division!\n");
// }
// else
// {
// printf("chai becho\n");
// }
//Nested If
/*
float marks;
printf("enter ur marks :");
scanf("%f",&marks);
if(marks>=60)
{
printf("first division pass!\n");
if(marks == 100)
{
printf(" u got 1 lac. Scholarship \n");
}
}
else if(marks>=50)
{
printf("2nd division!\n");
}
else if(marks>=33)
{
printf("3rd division!\n");
}
else
{
printf("chai becho\n");
} */
return 0;
}