Facebook
From Lish, 3 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 95
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int PrintTables(int x)
  5. {
  6. int n,a,b,c,d,e,l;
  7. n=x%10;
  8. cout<<n<<endl;
  9.  
  10. l=x/10;
  11. a=l%10;
  12. cout<<a<<endl;
  13.  
  14. b=l/10;
  15. c=b%10;
  16. cout<<c<<endl;
  17.  
  18. d=b/10;
  19. e=d%10;
  20. cout<<e<<endl;
  21.  
  22. for (;e<=c;e++)
  23.   {
  24.   cout<<"\n"<<a<<" * "<<e<<" = "<<e*a;
  25.   }
  26.  
  27. for (;e<=c;e++)
  28.   {
  29.   cout<<"\n"<<n<<" * "<<e<<" = "<<e*n;
  30.   }
  31.  
  32. return x;
  33. }
  34.  
  35. int main()
  36. {
  37.  int number;
  38.  cout<<"Enter four digit number "<<endl;
  39.  cin>>number;
  40. PrintTables (number);
  41. return 0;
  42. }