Print the square roots of the first 25 odd positive integers.
#include <iostream>
#include <cmath>
#include <iomanip>
int main()
{
for (int n = 1, i = 0; i < 25; n += 2, ++i)
{
std::cout << "Number " << n << " has square root: " << std::fixed << std::setprecision(5) << std::sqrt(n) << std::endl;
}
return 0;
}
Comments
Leave a comment