#include <iostream>
#include <cmath>
usingnamespace std;
// declare a constant for upper range limit
// call it TEN_K and set it to 10000
constint TEN_K = 10000;
int main()
{
for(int number = 0 ; number <TEN_K ; number++ )
if (number % 2 == 0) //numberIsEven
{
return 0;
}
if (number % 2 != 0) //numberIsOdd
{
int square;
square = pow(number);
}
return 0;
}
pow takes two arguments, the number and the exponent. So you would want to say pow(number, 2). However it's overkill to use pow to square a number when you can simply say number * number.
#include <iostream>
#include <cmath>
// declare a constant for upper range limit
// call it TEN_K and set it to 10000
constint TEN_K = 100;
int main()
{
for (int number = 0; number < TEN_K; number++)
{
if (number % 2 == 0) //numberIsEven
{
// return 0;
}
if (number % 2 != 0) //numberIsOdd
{
std::cout << number << ' ';
int square = std::pow(number, 2.0);
std::cout << square << '\t';
}
}
}