Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement