Java program to display Floyd's triangle
Floyd's triangle:
Program Example:
import java.util.Scanner;
public class Floyd
{
public static void main(String[] args)
{
int i, j, number=1;
Scanner sc = new Scanner(System.in);
System.out.print("Enter number of rows: ");
int n = sc.nextInt();
for(i=0;i<n;i++)
{
for(j=0;j<i;j++)
{
System.out.print(number + " ");
number++;
}
System.out.println();
}
}
}
Output:
Enter number of rows: 7
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
"If you have any other logic to attain the same result please email the code to sharkrish50@gmail.com"
Floyd's Triangle |
Program Example:
import java.util.Scanner;
public class Floyd
{
public static void main(String[] args)
{
int i, j, number=1;
Scanner sc = new Scanner(System.in);
System.out.print("Enter number of rows: ");
int n = sc.nextInt();
for(i=0;i<n;i++)
{
for(j=0;j<i;j++)
{
System.out.print(number + " ");
number++;
}
System.out.println();
}
}
}
Output:
Enter number of rows: 7
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
"If you have any other logic to attain the same result please email the code to sharkrish50@gmail.com"
Best Casino in Las Vegas, NV - Mapyro
ReplyDeleteLas Vegas' first casino opened twenty-two years 창원 출장마사지 ago. Today, the Wynn Hotel and Casino has over 2,600 부천 출장샵 rooms in multiple 광주 출장샵 towers, 제주 출장마사지 including 5,000 거제 출장마사지