Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<cmath>
- #include<fstream>
- using namespace std;
- int main()
- {
- int first, second, neednumb,d;
- ifstream fin("INPUT.txt");
- ofstream fout("OUTPUT.txt");
- fin >> first >> second >> neednumb;
- d = second - first;
- if (first<0||first>1000||second<0||second>1000)
- {
- return 0;
- }
- fout << first + d * (neednumb - 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement