Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Floyd {
- static void do_floyd(int n)
- {
- int k=1;
- for(int i=1 ; i <= n ; i++)
- {
- for(int j=1 ; j <= i ; j++)
- {
- System.out.print(k++ +" ");
- }
- System.out.println();
- }
- }
- public static void main(String args[])
- {
- Scanner sc = new Scanner(System.in);
- System.out.print("Enter no of rows : ");
- int n = sc.nextInt();
- do_floyd(n);
- }
- }
Add Comment
Please, Sign In to add comment