Advertisement
rengetsu

ProcedurProgramavimas_1.13

Feb 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5. int main()
  6. {
  7.     long double sum=0;
  8.     long double a, n;
  9.     cin>>a;
  10.     cin>>n;
  11.    
  12.     for(int i = a-1; i < n; i++ )
  13.     {
  14.         sum+=a;
  15.         a+=1;
  16.     }
  17.    
  18.     cout<<fixed<<setprecision(0)<<sum<<endl;
  19.    
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement