Write a program to print nth power of 10 using while loop
Take n as an integer input and print the nth of 10 as an integer output.
Input Format
For each test case, n will be given as an integer input.
Constraints
0<=n<=8
Output Format
Print the answer as an integer ouput.
Sample Input 0
1
Sample Output 0
10
Sample Input 1
0
Sample Output 1
1
Sample Input 2
2
Sample Output 2
100
Sample Input 3
3
Sample Output 3
1000
Sample Input 4
5
Sample Output 4
100000
Sample Input 5
7
Sample Output 5
10000000
ALSO READ : Print the Number Pattern 2
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
int n=scn.nextInt();
int ans =1;
int i=1;
while(i<=n)
{
ans=ans*10;
i++;
}
System.out.print(ans);
}
}