WRITE ONE C PROGRAM Write a program that computes the xth te

**********WRITE ONE C++ PROGRAM***********

Write a program that computes the xth term and summation of the following sequences, where x is a user input between 1 and 100.

1. -1,1,3,5,7,....

Compute the summation of all the elements between 1st and xth term.

2. 1,-sqrt(2),2,....

Compute the summation of all the elements between xth and 100th term.

3. 13,23,33

compute the summation of all the odd postion elements between xth and 100th term.

4.   jn=i n2

assume that i and j are integers from user input, where i, j>0 and i<j. write a program that computes the summation of all the elements between ith and jth term.

Solution


#include <iostream>
using namespace std;

int main(){

int number;
int x,i,j;
int sum = 0;
cout << \"Enter a positive integer: \";
cin >> x;
  
for(number = -1;number <= x; number++)
if (number%2!=0)
sum = sum + number;
cout << \"Sum = \" << sum;
cout<<\"\ \";
sum=0;
for (number=x;number<=100;number++)
sum=sum+number;
cout << \"Sum = \" << sum;
cout<<\"\ \";
sum=0;
for (number=x;number<=100;number++)
if (number%2!=0)
sum = sum + number;   
cout << \"Sum = \" << sum;
cout<<\"\ \";
sum=0;
cout << \"Enter I: \";
cin >> i;
cout << \"Enter J: Greater than J\";
cin >> j;
for (number=i;number<=j;number++)
sum=sum+number;
cout << \"Sum = \" << sum;
cout<<\"\ \";
return 0;

}

**********WRITE ONE C++ PROGRAM*********** Write a program that computes the xth term and summation of the following sequences, where x is a user input between
**********WRITE ONE C++ PROGRAM*********** Write a program that computes the xth term and summation of the following sequences, where x is a user input between

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site