Today I show how to using while and how while loop generate table
simple and working java code
import java.util.Scanner;
Scanner input = new Scanner(System.in);
System.out.println("Enter your Table number");
int n=input.nextInt();
int Counter =1;
while(counter<=10){
System.out.println(n+" * "+ counter+" = "+n*counter);
counter++;
}
}
}
Complete Program
simple and working java code
Tables In Java
import java.util.Scanner;
public class tables{
public static void main(String args[]){Scanner input = new Scanner(System.in);
System.out.println("Enter your Table number");
int n=input.nextInt();
int Counter =1;
while(counter<=10){
System.out.println(n+" * "+ counter+" = "+n*counter);
counter++;
}
}
}
Complete Program
No comments:
Post a Comment