0
How to print table of a number using buffered reader?
2 odpowiedzi
0
sorry but buffered reader is used to input a no.
0
import java.io.*;
public class MultiplicationTable {
private static PrintStream p=System.out;
public static BufferedReader q= new BufferedReader (new InputStreamReader (System.in));
public static void main(String []args)throws IOException{
int n,x,y,z;
p.println("MULTIPLICATION TABLE");
do{
p.print("Enter a number (2-12): ");
String num=q.readLine();
n=Integer.parseInt(num);
}
while(n<=1||n>=13);
for (x=1; x<=n; x++){
for (y=1; y<=n; y++){
z=x*y;
p.print(z +" ");
}
p.println();
}
}
}