summation of natural number sequence with c and c 2b 2b

Solutions on MaxInterview for summation of natural number sequence with c and c 2b 2b by the best coders in the world

showing results for - "summation of natural number sequence with c and c 2b 2b "
Reginald
07 Jan 2018
1#include<bits/stdc++.h>
2using namespace std;
3int main()
4{    
5  unsigned int a, b;    
6  long long int sum = 0, n;    
7  double s1;    
8  cin >> a >> b;    
9  n = (b-a) + 1;    
10  sum = n * ((double)(a+b) / 2);    
11  cout << sum << endl;        
12  return 0;
13}
similar questions