Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include<cmath>
  3. #include<fstream>
  4.  
  5.  
  6. using namespace std;
  7.  
  8.  
  9.  
  10. int main()
  11. {
  12. int first, second, neednumb,d;
  13.  
  14. ifstream fin("INPUT.txt");
  15. ofstream fout("OUTPUT.txt");
  16. fin >> first >> second >> neednumb;
  17.  
  18. d = second - first;
  19.  
  20. if (first<0||first>1000||second<0||second>1000)
  21. {
  22. return 0;
  23. }
  24.  
  25. fout << first + d * (neednumb - 1);
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement