Computer Science, asked by aakankshagupta745, 11 months ago

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 mayursanjaydeshmukh
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 anagasatyasri710
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