C Program for Traffic Light using Switch Case

C Program for Traffic Light

#include <stdio.h>


Void main ()


char colour;

printf ("Enter the colour of the light (R,G,Y): ");

scanf ("%c", &colour);

switch (colour)


case 'R':

case 'r':

printf ("STOP \n");


case 'Y':

case 'y':

printf ("WAIT\n");


case 'G':

case 'g':

printf ("GO \n");



printf ("The colour is not valid \n");




17 views0 comments

Recent Posts

See All

Group Flights Gone are the days when people like to fly all along. As the Standard of living is increasing by leap and bond, people to show their influence or to impression many offers to take on a gr

CSS MCQ Q 1. What is CSS? a. CSS is a style sheet language b. CSS stands for Cascading style sheet. c. CSS is used to style the HTML documents d. All of the mentioned Answer: d Q

HTML MCQ: Q. HTML Full form: a. HighText Machine Language b. HyperText and links Markup Language Hyper Text Marquee Language HyperText Markup Language Answer: d Q. The correct sequence of