Source code of Floydtriangle in java

Wednesday, March 18, 2009

import java.io.*; class Floydtriangle { public static void main(String args[])throws IOException { String a,b,c; int n,j,k; BufferedReader BR=new BufferedReader(new InputStreamReader(System.in)); a=BR.readLine(); //b=BR.readLine(); n=Integer.parseInt(a); //r=Integer.parseInt(b); int r=1; for(int i=1;i<=n;i++) { for( j=1;j<=i;j++) { System.out.printf("%4d",r); r=r+1; } System.out.printf("\n\n"); } } } To download the program click here:Floydtriangle.java

0 comments:

Visitors

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

  © Blogger template Leaving by Ourblogtemplates.com 2008

Back to TOP