Java programming code

Thursday, January 15, 2009

/* This program determine a pyramide Sample input 5 Sample output 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 */ import java.io.*; class c710 { 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 m=d;m System.out.print(" "); for(int b=1;b<=d;b++) { System.out.print(d); System.out.print(" "); } System.out.println(); } } }

0 comments:

Visitors

PlugIn.ws - Free Hit Counter, Web Site Statistics, Traffic Analysis

  © Blogger template Leaving by Ourblogtemplates.com 2008

Back to TOP