alarm
Ask a question for free
Computer Science
sweep

Write a program to input a string and display it's characters in the following partten​

answers: 1
Register to add an answer
Answer:

Answer:

import java.util.Scanner;

class PAGE_Rainbow

{

public static void main (String arg[])

{

Scanner in = new Scanner(System.in);

int op;

System.out.println("1-V");

System.out.println("2-I");

System.out.println("3-B");

System.out.println("4-G");

System.out.println("5-Y");

System.out.println("6-O");

System.out.println("7-R");

System.out.println("ENTER YOUR CHOICE");

op=in.nextInt();

switch(op)

{

case 1:

System.out.println("VOILET");

break;

case 2:

System.out.println("INDIGO");

break;

case 3:

System.out.println("BLUE");

break;

case 4:

System.out.println("GREEN");

break;

case 5:

System.out.println("YELLOW");

break;

case 6:

System.out.println("ORANGE");

break;

case 7:

System.out.println("RED");

break;

default:

System.out.println("invalid option");

}

  }

    }

401
Shelly Newman
For answers need to register.
Contacts
mail@expertinstudy.com
Feedback
Expert in study
About us
For new users
For new experts
Terms and Conditions