341 Accent a character. Print corresponding colour
namel Eginput w Output white)
Answers
import java.io.*;
class colour
{
public static void main () throws IOException
{
DataInputStream in = new DataInputStream (System.in);
char ch=' ';
System.out.print("Enter a letter......");
ch=(char)System.in.read();
switch(ch)
{
case'w': System.out.print("White);
break;
case'r': System.out.print("Red");
break;
case'b': System.out.print("Black, Brown,Blue");
break;
case'g': System.out.print("Green");
break;
default: System.out.print("Out of the range");
}
}
}
MARK AS BRAINLIEST PLEASE.....
PLEASE FOLLOW ME.....
Explanation:
clrscr();
printf("Enter character (R/G/B): ");
color= getchar();
switch (color)
{
case 'R':
printf ("Red") ;
break;
case 'G':
printf("Green");
break;
case 'B':
printf("Blue");
break;
}
getch();
}
HOPE IT HELPS
..