> Write a program to print following pattern:
Solution:
You can request if you want the logic of any such program in Java.
Please email or leave a comment here.. Thanks much! :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
E | |
ED | |
EDC | |
EDCB | |
EDCBA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
class test | |
{ | |
public static void main(String ar[]) | |
{ | |
Scanner scan = new Scanner(System.in); | |
System.out.println("Enter the limit: "); | |
int limit = scan.nextInt(); | |
int x = limit-1; | |
int y = 65+limit-1; | |
for(int i=0;i<limit;i++) | |
{ | |
for(int k=0;k<x;k++) | |
{ | |
System.out.print(" "); | |
} | |
for(int j=0;j<=i;j++) | |
{ | |
System.out.print((char)y); | |
y--; | |
} | |
System.out.println(); | |
y=65+limit-1; | |
x--; | |
} | |
} | |
} |
Comments
Post a Comment