Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MultTable {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6.  
  7. int num = sc.nextInt();
  8.  
  9. for (int i=0; i<num; ++i) {
  10. System.out.printf("%4d", i);
  11. }
  12. System.out.println();
  13. for (int i=0; i<num*4; ++i) {
  14.  
  15. System.out.print("_");
  16. }
  17. for (int i=0; i<num; ++i) {
  18. if (i==0) {
  19. System.out.printf("%8d", i);
  20. } else {
  21. System.out.printf("%4d", i);k
  22. }
  23. for (int j=0; j<num; ++j) {
  24. System.out.printf("%4d", (i*j)%num);
  25. }
  26. System.out.println();
  27. }
  28. }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement