import java.util.Scanner; public class Multiples{ public static void main(String[] args) { int n, i; Scanner sc=new Scanner(System.in); System.out.printf("Enter the number:"); n=sc.nextInt(); for(i=1; i<=10; ++i) System.out.printf("%d * %d = %d \n", i, n, n*i); } }
Output:
Enter the number:51 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50
No comments:
Post a Comment