C++ Arithmetic Operator Squaring odd numbers
#include <iostream> #include <iomanip> int main() {/*from w ww . j a va 2 s .c o m*/ int limit {}; std::cout << "Enter the upper limit for squared odd numbers: "; std::cin >> limit; for (int i {1}; i <= limit; i += 2) std::cout << std::setw(4) << i << " squared is " << std::setw(8) << i * i << std::endl; }