Star printing program in Java: pattern 5
Here is the code for this pattern:
import java.util.Scanner;public class star {
public static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n, i, j, k;
System.out.println("How many row you want: ");
n = sc.nextInt();
for(i=1;i<=n;i++)
{
for(k=0;k<=n-i;k++)
{
System.out.print(" ");
}
for(j=n;j>=k;j--)
{
System.out.print("*");
}
System.out.print("\n");
}
}
}
Try this in C.
Excellent post, now a day’s huge demand for the certified java professionals in IT industry. Java gives more career opportunity for the fresher’s as well as experienced experts.
ReplyDeleteRegards,
JAVA Training in Chennai|JAVA Course in Chennai
Post a Comment