loop
Write a program to show uses of all three loops.(print tables)
import java.util.Scanner; class P10Loop { public static void main(String args[]) { int x,i; System.out.println("Enter the number whose table you want"); Scanner in = new Scanner(System.in); x = in.nextInt(); for(i=1;i<11;i++) System.out.println(x + " X " +i +" = "+ (x*i)); x++;i=1;System.out.println("\n\n"); while(11>i) { System.out.println(x*i); i++; } x++;i=1;System.out.println("\n\n"); do { System.out.println(x*i); i++; } while(11>i); } }
Comments
Post a Comment