Sum of given numbers

Description:

Assume that the program has three functions to perform addition. The first accepts two integers, second accepts three arguments and third accepts four integers and returns the sum of given numbers Test Case 1 Input (stdin) 10 20 30 40 Expected Output Sum of 2 nos is 30 Sum of 3 nos is 60 Sum of 4 nos is 100 Test Case 2 Input (stdin) 5 10 15 20 Expected Output Sum of 2 nos is 15 Sum of 3 nos is 30 Sum of 4 nos is 50

Program :

#include <iostream>

using namespace std;

int main()

{

int a,b,c,d;

  cin>>a>>b>>c>>d;

  cout<<"Sum of 2 nos is "<<a+b;

  cout<<"\nSum of 3 nos is "<<a+b+c;

  cout<<"\nSum of 4 nos is "<<a+b+c+d;

return 0;

}