Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MultTable {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int num = sc.nextInt();
- for (int i=0; i<num; ++i) {
- System.out.printf("%4d", i);
- }
- System.out.println();
- for (int i=0; i<num*4; ++i) {
- System.out.print("_");
- }
- for (int i=0; i<num; ++i) {
- if (i==0) {
- System.out.printf("%8d", i);
- } else {
- System.out.printf("%4d", i);k
- }
- for (int j=0; j<num; ++j) {
- System.out.printf("%4d", (i*j)%num);
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement