Program : Show Sqaures of Number
This program first take input from user that an integer value and show the squares of term upto the number that enter by user like if i enter 2 then it display square of 1 and 2 and if i enter any number its show squares upto that term...
#include<iostream.h>
#include<conio.h>
int main()
{
int a;
cout << "Enter a Value upto you want to show squares of that number\n";
cin >> a;
//Using for Loop
for(int i =1; i <=a; i++)
{
cout << i << " Square is : " << i*i <<endl; // show square of that number
}
getch();
return 0;
}
OUTPUT:-
I enter Value 10
This program first take input from user that an integer value and show the squares of term upto the number that enter by user like if i enter 2 then it display square of 1 and 2 and if i enter any number its show squares upto that term...
#include<iostream.h>
#include<conio.h>
int main()
{
int a;
cout << "Enter a Value upto you want to show squares of that number\n";
cin >> a;
//Using for Loop
for(int i =1; i <=a; i++)
{
cout << i << " Square is : " << i*i <<endl; // show square of that number
}
getch();
return 0;
}
OUTPUT:-
I enter Value 10
0 comments:
Post a Comment