Problem:
1. You are given a number n.
2. You've to create a pattern of * and separated by tab as shown in output format.
Constraints
1 <= n <= 100
Sample Input
5
Sample Output
* * * * *
* * * *
* * *
* *
*
Solution:
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
// write ur code here
int n=scn.nextInt();
for(int i=n;i>0;i--){
for(int j=i;j>0;j--)
System.out.print("*\t");
System.out.println();
}
}
}
Comments
Post a Comment