WAP to find some of the attached series.....>>>>>>15 points
Attachments:
Answers
Answered by
1
1.
int n;
cin>> n;
double sum= 0;
double term ;
for(int i =1; i<=n;i++){
sum += ((i)+(i+1))/((i+1)*(i+2));
}
cout<< sum;
2.
int n;
cin>> n;
double sum= 0;
double term =1;
for(int i =1; i<=n;i++){
term = term /i;
sum += term;
}
cout<< sum;
That's it!
Include the header file iostream like the standard programs.
int n;
cin>> n;
double sum= 0;
double term ;
for(int i =1; i<=n;i++){
sum += ((i)+(i+1))/((i+1)*(i+2));
}
cout<< sum;
2.
int n;
cin>> n;
double sum= 0;
double term =1;
for(int i =1; i<=n;i++){
term = term /i;
sum += term;
}
cout<< sum;
That's it!
Include the header file iostream like the standard programs.
uneq95:
but i would have to write everything again..
Answered by
1
import java.util.*;
public class Series1
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
double i,n,sum=0,p;
System.out.print("Enter the value of n: ");
n = in.nextDouble();
for (i=1;i<=n;i++)
{
p = (i+(i+1))/((i+1)*(i+2));
sum = sum + p;
}
System.out.println();
System.out.println("Sum of given series is: "+sum);
}
}
_____________________________________________________________
import java.util.*;
public class Series2
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
double i,p=1,s=0,n;
System.out.print("Enter the value of n: ");
n = in.nextDouble();
for (i=1;i<=n;i++)
{
p=p*i;
s+=1/p;
}
System.out.println();
System.out.println("Sum of series is: "+s);
}
}
public class Series1
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
double i,n,sum=0,p;
System.out.print("Enter the value of n: ");
n = in.nextDouble();
for (i=1;i<=n;i++)
{
p = (i+(i+1))/((i+1)*(i+2));
sum = sum + p;
}
System.out.println();
System.out.println("Sum of given series is: "+sum);
}
}
_____________________________________________________________
import java.util.*;
public class Series2
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
double i,p=1,s=0,n;
System.out.print("Enter the value of n: ");
n = in.nextDouble();
for (i=1;i<=n;i++)
{
p=p*i;
s+=1/p;
}
System.out.println();
System.out.println("Sum of series is: "+s);
}
}
Similar questions