In: Computer Science
Write a C program/code that prompts the user for a minimum min and a maximum max. Then use these values to print the squares of all even numbers between the min and max variables. For example if the user enters 6 as the minimum and 200 as the maximum, the program/code should print the following.
Enter limit on minimum square:
6
Enter limit on maximum square:
200
36
64
100
144
196
Program
#include <iostream>
using namespace std;
int main() {
int min, max;
cout << "Enter limit on minimum square: ";
cin >> min;
cout << "Enter limit on maximum square: ";
cin >> max;
for (int i = min; i*i <= max; i += 2) {
cout << i*i << endl;
}
return 0;
}