Using a while loop create a program that will prompt the user for a positive number and then print out a multiplication list of all the between the given number and one(inclusive), These are referred to as the factorial and it is only applicable for positive numbers, see link for more
import java.util.Scanner;
public class Main{
public static void main(String args[]){
Scanner input=new Scanner(System.in);
int x;
System.out.print("Input a number: ");
x=input.nextInt();
int y=1;
while( y<=10){
System.out.println(x+"x"+y+"="+x*y);
y++;
}
}
}
Comments
Leave a comment