Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class triangle {
- public static void main(String[]args)
- {
- Scanner reader = new Scanner(System.in);
- System.out.print("Rows: ");
- int iRows = reader.nextInt();
- for(int i = 1; i <= iRows; i++)
- {
- printStars(i);
- }
- for(int c = iRows; c >= 0; c--)
- {
- printStars(c);
- }
- }
- public static void printStars(int iStars)
- {
- for(int y = 1; y <= iStars; y++)
- {
- System.out.print("@");
- }
- System.out.print("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement