In this short article I would like to share with you a program that I wrote using Java as my programming language I called this program multiplication table. What the program does is that it will display a multiplication table on the screen very similar that is being used in elementary mathematics.
I hope you will find my work useful in learning how to program in Java. If you have some questions please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
People here in the Philippines can reach me at my mobile number 09173084360.
Thank you very much and Happy Programming.
Sample Program Output
Program Listing
// multiplication_table.java
// Written By: Mr. Jake R. Pomperada, MAED-IT
// Date : July 7, 2015
// Email Address: jakerpomperada@yahoo.com
// jakerpomperada@gmail.com
public class multiplication_table {
public static void main(String[] args) {
int Table_Size = 10;
Display(Table_Size);
}
public static void Display(int Table_Size) {
System.out.print("\t\t MULTIPLICATION TABLE ");
System.out.print("\n\n");
System.out.format(" ");
for(int i = 0; i<=Table_Size ;i++ ) {
System.out.format("%4d",i);
}
System.out.println();
System.out.println(" -------------------------------------------------");
for(int i = 0 ;i<=Table_Size ;i++) {
System.out.format("%4d |",i);
for(int j=0;j<=Table_Size ;j++) {
System.out.format("%4d",i*j);
}
System.out.println();
}
System.out.println("\n");
System.out.println("\t\t END OF PROGRAM");
System.out.println("\n\n");
}
}
No comments:
Post a Comment