plz answer !.............
Attachments:
nitish8089:
programming language.
Answers
Answered by
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");
}
}
}
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