Problem: Create program that ask the user to input "How many hello world you want to print" and the output show number and hello world.
import java.util.Scanner;
public class helloworld
{
public static void main(String args[])
{
Scanner input=new Scanner(System.in);
int num;
int start=1;
System.out.print("How hello world you want to display");
num=input.nextInt();
while(start<= num)
{
System.out.println(start + ".Hello");
start++;
}
}
}
No comments:
Post a Comment