Java

Calculate Floyd Triangle Program Using Java

Calculate Floyd Triangle Program Using Java
/* 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"); 
} 
}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.