import java.util.Scanner;
public class First2 {
public void p1() {
Scanner sc = new Scanner(System.in);
int row = sc.nextInt();
for (int i = 1; i <= row; i++) {
for (int j = i; j < row; j++) {
System.out.print(" ");
}
for (int j = 1; j <= 2 * i - 1; j++) {
System.out.print("*");
}
System.out.println();
}
}
public void p2() {
Scanner sc = new Scanner(System.in);
int rows1 = sc.nextInt();
for (int i = 1; i <= rows1; i++) {
for (int j = i; j < rows1; j++) {
System.out.print(" ");
}
for (int j = 1; j <= (2 * i - 1); j++) {
System.out.print("*");
}
System.out.println();
}
for (int i = rows1; i >= 1; i--) {
for (int j = i; j < rows1; j++) {
System.out.print(" ");
}
for (int j = 1; j <= (2 * i - 1); j++) {
System.out.print("*");
}
System.out.println();
}
}
public void p3() {
Scanner sc = new Scanner(System.in);
int row = sc.nextInt();
for (int i = 1; i <= row; i++) {
for (int j = i; j < row; j++) {
System.out.print(" ");
}
for (int k = 1; k <= 2 * i - 1; k++) {
System.out.print("*");
}
System.out.println();
}
}
public static void main(String[] args) {
First2 f = new First2();
f.p1();
f.p2();
f.p3();
// f.ArithError();
}
}
output
-------------
3
*
***
*****
4
*
***
*****
*******
*******
*****
***
*
5
*
***
*****
*******
*********
8 Comments
This comment has been removed by the author.
ReplyDeleteI recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. הדפסות על חולצות חולון
ReplyDeleteI wanted to thank you for this in your liking ensnare!! I particularly enjoying all tiny little bit of it I have you ever bookmarked to check out delivered stuff you pronounce. Letterhead Printing
ReplyDeleteWhile GPS coupons may appear to be a fantastic component for organizations that need to build foot exchange, they won't fill in too for organizations that require appearance by arrangement as it were.í† í† ë¨¹íŠ€
ReplyDeleteI am eager the set up. It is wonderful to determine many people explain in words from your nature as well as capability upon which basic subject region are usually easily discovered. printers new orleans
ReplyDeleteThey offer day in and day out free specialized help which is best in class. On the off chance that you ever have any inquiries or issues, you can get in touch with them with any specialized inquiries.7zip
ReplyDeleteAfter examine a number of of the blog posts in your web site now, and I truly like your way of blogging. I bookmarked it to my bookmark website listing and might be checking back soon. Pls check out my web site as well and let me know what you think. informasi percetakan
ReplyDeleteThis is actually intriguing, You’re an exceptionally effective blogger. I’ve enrolled with your feed and furthermore , look ahead to reading your marvelous write-ups. What’s more, We have shared your internet site inside our social networks. you can try this out
ReplyDelete