64 521
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #34908 in C++ for Muldir

Question #34908
Write a program that calculates element of sequence by its index if given first and second elements of arithmetic sequence.Input first, second elements of sequence and index:
1 5 3
Expert's answer
#include <cstdlib>
#include <iostream>


using namespace std;


int main()
{
int a,b,n;
cin>>a>>b>>n;
cout<<a+(n-1)*(b-a)<<endl;
cin.get();
cin.get();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions