Friday, 20 April 2018

Program To Displays Colours According To The Enter Character From User in C

/*program to print colour*/
# include <stdio.h>
void main ()
{
char ch ;
clrscr () ;
printf ("/n enter a character :") ;
scanf ("%c", & ch) ;
switch (ch)
{
case 'r' ;
printf ("/n colour is red :") ;
break ;
case 'w' ;
printf ("/n colour is white :") ;
break ;
case 'y' ;
printf ("/n colour is yellow :") ;
break ;
case 'g' ;
printf ("/n colour is green :") ;
break ;
case 'b' ;
printf ("/n colour is blue :") ;
break ;
default :
printf ("/n invalid character :") ;
}
getch () ;
}

No comments:

Post a Comment

Featured post

Kalgudi Interview Round!!

Those who cleared the second round of kalgudi got an email from exceller to complete their Kalgudi Interview Round. So here we will discuss ...