Write a program to find the following series upto n terms:
1,4,9...
Answers
Answered by
4
#include<iostream.h>
#include<conio.h>
void main( )
{
clrscr( );
int n,i;
cout<<"enter upto number";
cin>>n;
for(i=1;i<=n;i+=4)
{
cout<<i<<"\t";
i++;
}
getch( );
}
Answered by
2
Answer:
import java. util.*;
public class Series
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int n, a,b;
System.out.println("Enter the value of n");
for(a=1; a<=n;a++);
{
b=Math.pow(a,2);
System.out.println("The series is ="+b);
}
}
}
Explanation:
Since, it is a series of square of the value.
Such that,
(1)^2 =1
(2)^2=4
(3)^2=9
And so on.
Similar questions
English,
5 months ago
Hindi,
5 months ago
Social Sciences,
5 months ago
Computer Science,
9 months ago
Math,
9 months ago