Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int getDivisor();
- int findNumbers(int divisor);
- int calcSquare(int count);
- // =======================================
- // main
- // =======================================
- int main()
- {
- int divisor;
- divisor = getDivisor();
- findNumbers(divisor);
- system("pause");
- return 0;
- }
- int getDivisor()
- {
- int divisor;
- cout << "Enter a divisor: " << endl;
- cin >> divisor;
- return divisor;
- }
- int findNumbers(int divisor)
- {
- int count = 0;
- while ((count >= 0) && (count <= 100));
- {
- if ((count % divisor) == 0)
- {
- int numSquared;
- numSquared = calcSquare(count);
- cout << count << setw(3) << numSquared << endl;
- }
- count++;
- }
- return count;
- }
- int calcSquare(int count)
- {
- int numSquared;
- numSquared = pow(count, 2);
- return numSquared;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement