1. Write a java application that uses looping to print the following table of values:
N 10*n 100*n 1000*n
1 10 100 1000
2 20 200 2000
3 30 300 3000
4 40 400 4000
5 50 500 5000
hints:
• use the following line of code to print out the heading of the table:
System.out.println( "n\t10*n\t100*n\t1000*n\n" );
• you should use one more print statement inside a while loop to print the rest of the table.
الحل:
كود PHP:
int n=1;
system.out.print("n\t10*n\t100*n\t1000*n\n" );
while(n<=5){
system.out.print(n+"\t"+10*n+"\t"+100*n+"\t"+1000*n+"\n");
n++;}
بالتوفيق