Pyramid Pattern printing in java language|| Pattern printing in interview question|| by er prince kumar
Pyramid Pattern printing in java language
Java Program to Print Star Pyramid Patterns. Java Program - Pattern 2. public class JavaProgram { public static void main(String args[]) { int i, j, k=1; for(i=0; i<5; i++) { for(j=0; j<k; j++) { System.out.print("* "); } k = k + 2; System.out.println(); } } } Java Program - Pattern 3. Java Program - Pattern 4. Java ..
==============================================
import java.util.Scanner;
class Parimid
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int i=0;i<n;i++){
for(int j=0;j<n*3-i;j++){
System.out.print(" ");
}
for(int j=0;j<=i;j++){
System.out.print("* ");
}
System.out.println();
}
}
}
class Parimid
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int i=0;i<n;i++){
for(int j=0;j<n*3-i;j++){
System.out.print(" ");
}
for(int j=0;j<=i;j++){
System.out.print("* ");
}
System.out.println();
}
}
}
===================================================================
Comments
Post a Comment