Advertisement
Shaun_B

Not using a look-up table

Feb 2nd, 2012
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <conio.h>
  4. // Function prototypes:
  5. int main();
  6. int multi(int, int);
  7. // Global variables:
  8. int i=0;
  9. int c=0;
  10. int main()
  11. {
  12.     // Clears console (might not work with Visual Studio 2010, but okay with Code::Blocks)
  13.     system("cls");
  14.     //printf("Multiplying not using a look-up table:\n");
  15.     // Loop:
  16.     for(i=0; i<13; i=i+1)
  17.     {
  18.         // Nested loop:
  19.         for(c=0; c<13; c=c+1)
  20.         {
  21.             printf("%d x %d = %d\n",i,c,multi(i,c));
  22.         }
  23.     }
  24.     return 0;
  25. }
  26. // Returns multiplied values:
  27. int multi(int x, int y)
  28. {
  29.     return x*y;
  30. }
  31. // Donkeysoft MMXII
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement