-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboolean.c
More file actions
47 lines (39 loc) · 816 Bytes
/
Copy pathboolean.c
File metadata and controls
47 lines (39 loc) · 816 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
#include <stdio.h>
#include <stdbool.h>
int main()
{
// boolean, bool is a data type that is either true or false
// include the header file stdbool.h
// 1 used to represent the true.
// 0 used to represent the false.
// eg: bool isOnline = 1; means the value is true.
bool isOnline = true;
bool isStudent = true;
bool forSale = false;
// printf("%d", isOnline);
if (isOnline)
{
printf("You are online.\n");
}
else
{
printf("You are offline.\n");
}
if (isStudent)
{
printf("You are a student.\n");
}
else
{
printf("You are not a student.\n");
}
if (forSale)
{
printf("Item is for sale.\n");
}
else
{
printf("Item is not for sale.\n");
}
return 0;
}