Patterns

Write a java program to print star pattern

Output is following : 

*  *  *  *  *
 *  *  *  *  *
 *  *  *  *  *
 *  *  *  *  *
 *  *  *  *  * 

import java.util.Scanner;
          public class StarPattern {
static Scanner sc=new Scanner(System.in);
public static void main(String[] args) {
System.out.println("Enter n value");
int n=sc.nextInt();
for(int i=1;i<=n;i++) {
for(int j=1;j<=n;j++) {
System.out.print(" * ");
}
System.out.println();
}

}

}

Comments

Popular posts from this blog