(Tabular Output) Write a Java application that uses looping to print the following table of
values:
To print the results like a table structure we can use either printf() or format() method.
Both the methods belong to the classjava.io.PrintStream.
Tabular Output in Java Program
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
Tabular Output in Java Program
/*
* Filename: TabularOutput.java
*
* Description: Exercise 4.22 - Tabular Output
*
* @Author: Bilal Tahir Khan Meo
* Website: https://codeblah.com
*
* =====================================================================================
*/
public class TabularOutput{
public static void main(String[] args){
System.out.println("N\t\t10*N\t\t100*N\t\t1000*N");
for(int i=1; i<6; i++){
System.out.printf("%d\t\t%d0\t\t%d00\t\t%d000\n", i, i, i, i);
}
}
}