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 Volume of given box in java

class volume { public static void main (String args []) { int l=5,b=6,h=10; int volume; volume=l*b*h; System.out.println (" vol...