C++ Program to take a square of an integer value:
C++ Program to square a number:
Code:
#include <iostream> //include libraries
using namespace std;
int main()
{
int i=1,j=0,k=0; // defining numerical variable value
cout<<"enter value:";
while(i<=20) // using while loop to execute the same block of code until condition is met
{
cin>>j;
k=j*j;
i++; // it mean increment
cout<<"square of enter number is="<<k; //displays the output
}
return 0;
}
Comments
Post a Comment