Java programming
Wednesday, January 14, 2009
/*This is a program ,whics determine a piramide sample input 6; output 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 */ import java.io.*; class a710 { public static void main(String args[])throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); //DataInputStream in=new DataInputStream (System.in); System.out.println("Enter your number:"); int c=Integer.parseInt(in.readLine()); System.out.println("Your result is:"); for(int d=1;d<=c;d++) { for(int b=1;b<=d;b++) { System.out.print(d); System.out.print(" "); } System.out.println(); } } }
0 comments:
Post a Comment