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
1
Expert's answer
2013-09-10T11:06:24-0400
#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; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment