Advertisement
Guest User

Untitled

a guest
Mar 7th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class triangle {
  4.  
  5.     public static void main(String[]args)
  6.     {
  7.         Scanner reader = new Scanner(System.in);
  8.  
  9.         System.out.print("Rows: ");
  10.         int iRows = reader.nextInt();
  11.  
  12.         for(int i = 1; i <= iRows; i++)
  13.         {
  14.           printStars(i);
  15.  
  16.         }
  17.  
  18.         for(int c = iRows; c >= 0; c--)
  19.         {
  20.             printStars(c);
  21.         }
  22.     }
  23.  
  24.     public static void printStars(int iStars)
  25.     {
  26.         for(int y = 1; y <= iStars; y++)
  27.         {
  28.             System.out.print("@");
  29.         }
  30.  
  31.         System.out.print("\n");
  32.     }
  33.  
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement