C++ examples for Statement:while
What is the output of the program: while loop, arithmetic operator
#include <iostream> using namespace std; int main() {//from w ww . ja va2 s. c o m unsigned int x{1}; unsigned int total{0}; while (x <= 10) { int y = x * x; cout << y << endl; total += y; ++x; } cout << "Total is " << total << endl; }