import java.util.Scanner;
lic class Floyd_Triangle {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter no of row ");
int n = sc.nextInt();
System.out.println("The floyd triangle is :");
int a = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(a++);
}
System.out.println("");
}
}
}
/** DOCUMENTATION COMMENT
*Floyd triangle
* right angle triangle which is filled consecutive natural number starting with 1
* here we enter row no
* and the series is generated accordingly
* e.g 1
* 2 3
* 4 5 6
* and so on ...
*/
OUTPUT
Enter no of row4
The floyd triangle is :
1
23
456
78910
No comments:
Post a Comment