Computer Science, asked by JasmiR4103, 1 year ago

plz answer !.............

Attachments:

nitish8089: programming language.
JasmiR4103: ya
nitish8089: means?
JasmiR4103: yes
nitish8089: i mean to say you are reply after a month... and answer already given...
nitish8089: so any purpose for comment here...
JasmiR4103: I am sorry
JasmiR4103: this answer helped me a lot
nitish8089: nice... good night...
JasmiR4103: good night

Answers

Answered by nitish8089
1
import java.util.Scanner;
public class Pattern{
public static void main(String[] args) {
System.out.println("press N for Number pattern please see out the case of letter");
System.out.println("press C for Number pattern please see out the case of letter");
Scanner reader=new Scanner(System.in);
char c=reader.next().charAt(0);
switch (c) {
case 'N':
for(int i=5;i>=1;i--){
for(int j=i;j>=1;j--)
{
System.out.print(j);
}
System.out.println("");
}
break;
case 'C':
String str="INDIA";
for(int i=0;i<str.length();i++){
for(int j=0;j<=i;j++){
System.out.print(str.charAt(j));
}
System.out.println("");
}
break;
default:
System.out.println("Sorry Invalid Input");
}
}
}
Similar questions