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

Program to find maximum of three number using user define function in C++

A function can be define by the user as per the requirement of the user or programmer . To implement a user define function , a programmer ...