SHARE
TWEET

Untitled

a guest Oct 21st, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int getDivisor();
  2. int findNumbers(int divisor);
  3. int calcSquare(int count);
  4. // =======================================
  5. // main
  6. // =======================================
  7. int main()
  8. {
  9.     int divisor;
  10.  
  11.     divisor = getDivisor();
  12.     findNumbers(divisor);
  13.  
  14.     system("pause");
  15.     return 0;
  16. }
  17. int getDivisor()
  18. {
  19.     int divisor;
  20.  
  21.     cout << "Enter a divisor: " << endl;
  22.     cin >> divisor;
  23.  
  24.     return divisor;
  25. }
  26. int findNumbers(int divisor)
  27. {
  28.     int count = 0;
  29.  
  30.     while ((count >= 0) && (count <= 100));
  31.     {
  32.         if ((count % divisor) == 0)
  33.         {
  34.             int numSquared;
  35.             numSquared = calcSquare(count);
  36.             cout << count << setw(3) << numSquared << endl;
  37.         }
  38.         count++;
  39.     }
  40.     return count;
  41. }
  42. int calcSquare(int count)
  43. {
  44.     int numSquared;
  45.     numSquared = pow(count, 2);
  46.  
  47.     return numSquared;
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top