What a program in java that asks for a number (say a) and then print a1,a2,a3,a4,a5
Answers
Answered by
4
Answer:
import java.util.Scanner;
public class Sample {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the value of a")
int a = input.nextInt()
int a1 = a * 1;
System.out.println("Value of a X 1 = "+ String.valueOf(a1))
int a2 = a * 2;
System.out.println("Value of a X 2 = "+ String.valueOf(a2))
int a3 = a * 3;
System.out.println("Value of a X 3 = "+ String.valueOf(a3))
int a4 = a * 4;
System.out.println("Value of a X 4 = "+ String.valueOf(a4))
int a5 = a * 5;
System.out.println("Value of a X 5 = "+ String.valueOf(a5))
}
}
Similar questions
Social Sciences,
22 hours ago
English,
22 hours ago
Chemistry,
22 hours ago
Chemistry,
1 day ago
Chemistry,
8 months ago