Horje
Summation of Natural Number Sequence with c and c++. Code Example
Summation of Natural Number Sequence with c and c++.
#include<bits/stdc++.h>
using namespace std;
int main()
{    
  unsigned int a, b;    
  long long int sum = 0, n;    
  double s1;    
  cin >> a >> b;    
  n = (b-a) + 1;    
  sum = n * ((double)(a+b) / 2);    
  cout << sum << endl;        
  return 0;
}




Cpp

Related
use ster when declaring variables cpp Code Example use ster when declaring variables cpp Code Example
file is good in c++ Code Example file is good in c++ Code Example
c code to mips assembly converter online Code Example c code to mips assembly converter online Code Example
empty character constant error c++ Code Example empty character constant error c++ Code Example
play sound opencv video c++ Code Example play sound opencv video c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11