Q:

Calculate Floyd Triangle Program Using Java

0

This Program is used to calculate the Floyd Triangle.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

/* FLOYD'S TRIANGLE */ 
import java.io.*; 

class ssva9 
{ 
public static void main(String arg[]) throws IOException 
{ 
int n,m=1; 
System.out.println(" FLOYD'S TRIANGLE"); 
BufferedReader obj=new BufferedReader(new InputStreamReader(System.in)); 
System.out.print("\n ENTER THE POSITIVE INTEGER : "); 
n=Integer.parseInt(obj.readLine()); 
System.out.print("\n"); 
for(int i=1;i<=n;i++) 
{ 
for(int j=1;j<=i;j++) 
{ 
System.out.print(" "+m++); 
} 
System.out.println("\n"); 
} 
System.out.print("\n"); 
} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now