Computer Science, asked by ShaliniSNS, 1 year ago

341 Accent a character. Print corresponding colour
namel Eginput w Output white)

Answers

Answered by Anonymous
1

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.....

Answered by TheMoonlìghtPhoenix
0

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

..

Similar questions