Answers for "code to print pyramid of number in java"

0

java pyramid pattern

import java.util.Scanner;
public class Edureka
{
      
public static void main(String[] args) 
{
Scanner sc = new Scanner(System.in);
      
System.out.println("Enter the number of rows: ");
 
int rows = sc.nextInt();
          
for (int i = 1; i <= rows; i++) { for (int j = i; j >= 1; j--)
   {
       System.out.print(j+" ");
   }
     
   System.out.println();
}         
sc.close();
}
}
Posted by: Guest on September-16-2021
0

java pyramid pattern

import java.util.Scanner;
public class Edureka
{
      
public static void main(String[] args) 
{
Scanner sc = new Scanner(System.in);
      
System.out.println("Enter the number of rows: ");
 
int rows = sc.nextInt();
          
for (int i = 1; i <= rows; i++) { for (int j = i; j >= 1; j--)
   {
       System.out.print(j+" ");
   }
     
   System.out.println();
}         
sc.close();
}
}
Posted by: Guest on September-16-2021

Code answers related to "code to print pyramid of number in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language