Write a program to generate the first 'n' terms of the following series 121, 225, 361,...
Input Format:
The input is an integer 'n' which denotes the number of terms to be printed in the series.
Output Format:
Print the series and refer the sample output for formatting.
Answers
Answered by
11
Answer:
#include<iostream>
using namespace std;
int main()
{
int a,b,n,i,c;
cin>>n;
a=121;
b=11;
if(n==1)
{
cout<<"121"<<" ";
}
else
{
cout<<"121"<<" ";
for(i=2;i<n;i++)
{
b=b+4;
c=b*b;
cout<<c<<" ";
}
}
}
Explanation:
Answered by
24
Answer:
#include<iostream>
using namespace std;
int main()
{
int a,b,n,i,c;
cin>>n;
a=121;
b=11;
if(n==1)
{
cout<<"121"<<" ";
}
else
{
cout<<"121"<<" ";
for(i=2;i<=n;i++)
{
b=b+4;
c=b*b;
cout<<c<<" ";
}
}
}
Similar questions
Math,
5 months ago
Economy,
5 months ago
English,
5 months ago
Math,
11 months ago
Economy,
11 months ago
Accountancy,
1 year ago
World Languages,
1 year ago