C   51
table
Guest on 27th May 2023 02:47:20 AM


  1. /* C program for addition/multiplication tables mod N */
  2.  
  3. #define N 26
  4.  
  5. #define Letter(i) ( (char)(i)+'A' )
  6.  
  7. main()
  8. {
  9. int i,j;
  10.  
  11. printf("Addition and Multiplication Tables Mod N = %d\n",N);
  12.  
  13. for (i=0;i<N;i++) printf("%-3d",i); printf("\n");
  14. for (i=0;i<N;i++) printf("%-3c",Letter(i)); printf("\n");
  15.  
  16. printf("\n\n");
  17.  
  18. for (i=0;i<N;i++) {
  19.     for (j=0;j<N;j++) {
  20.         printf("%-3d",(i+j)%N);
  21.         }
  22.     printf("\n");
  23.     }
  24. printf("\n\n");
  25.  
  26. for (i=0;i<N;i++) {
  27.     for (j=0;j<N;j++) {
  28.         printf("%-3d",(i*j)%N);
  29.         }
  30.     printf("\n");
  31.     }
  32.  
  33. }

Raw Paste

Login or Register to edit or fork this paste. It's free.