Page 252 - CA_Blue( J )_Class9
P. 252
11 { for(j=1;j<=i;j++)
12 { System.out.print(k+" ");
13 k++;
14 }
15 System.out.println();
16 }
17 }
18 }
You will get the following output:
Program 7 Write a program to input number of lines and print the Floyd's Triangle using while loop.
1
2 3
4 5 6
7 8 9 10
1 import java.util.*;
2 class while_floyd
3 { public static void main()
4 { Scanner sc= new Scanner(System.in);
5 int i,j,n,k=1;
6 System.out.print("Enter number of lines : ");
7 n=sc.nextInt();
8 i=1;
9 while(i<=n)
10 { j=1;
11 while(j<=i)
12 { System.out.print(k+" ");
13 k++;
250 Touchpad Computer Applications-IX

