-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathifelseif.cpp
More file actions
57 lines (43 loc) · 901 Bytes
/
ifelseif.cpp
File metadata and controls
57 lines (43 loc) · 901 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
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<iostream>
using namespace std;
int main()
{
int a=20;
if(a==10)
{
cout<<"a has a value of 10";
}
else if(a==15)
{
cout<<"a has a value of 15";
}
else if(a==20)
{
cout<<"a has a value of 20";
}
else
{
cout<<"not sure what is a's value";
}
return 0;
}
/*
Syntax:
if (condition)
statement;
else if (condition)
statement;
.
.
else
statement;
here if is evaluated and then the else if when the if is false and continues till last else if.
finally the else is run when no condition matches.
*/
/********************************************************
Title: If-else-if ladder
Author: CAC
Date: 2nd April 2021
Description:
This code was implemented on day 5 of 100 days of code
*********************************************************/