Print Numbers By for loop
import java.util.*;
class forloop
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int n;
System.out.println("Enter the value:");
n=in.nextInt();
System.out.println();
for(int i=0;i<n;i++)
{
System.out.print(i);
}
}
}
output
No comments:
Post a Comment