-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminiproject.c
53 lines (49 loc) · 1.63 KB
/
miniproject.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
#include<stdio.h>
#include<unistd.h>
int main()
{
int i;
while(1)
{
printf(":::::::::::::::::::::::::::::::::::::::::::::::::::\n\n");
printf("*TRAFFIC LIGHT SIMULATION*\n\n");
printf(":::::::::::::::::::::::::::::::::::::::::::::::::::\n\n");
printf("Red Light : ON\n");
printf("Yellow Light : OFF\n");
printf("Green LIght : OFF\n\n");
printf("*STOP!*\n\n");
printf("countdown starts!\n\n");
printf("===================================================\n\n");
for(i=10;i>=0;i--)
{
printf("%d seconds left...\n",i);
sleep(1);
}
printf("\n\n***************************************************\n\n");
printf("Red Light : OFF\n");
printf("Yellow Light : ON\n");
printf("Green LIght : OFF\n\n");
printf("*GET READY!*\n\n");
printf("countdown starts!\n\n");
printf("===================================================\n\n");
for(i=3;i>=0;i--)
{
printf("%d seconds left...\n",i);
sleep(1);
}
printf("\n\n***************************************************\n\n");
printf("Red Light : OFF\n");
printf("Yellow Light : OFF\n");
printf("Green LIght : ON\n\n");
printf("*GO!*\n\n");
printf("countdown starts!\n\n");
printf("===================================================\n\n");
for(i=5;i>=0;i--)
{
printf("%d seconds left...\n",i);
sleep(1);
}
printf("\n");
}
return 0;
}