Solution for Mathematics challenge-Handshake-hackerRank

 

C++ solution for hackerRank Mathematics challenge-Handshake

-Dinesh Kumar E 

Code:

#include<iostream>
using namespace std;
int main()
{
int a,con,b;
cin>>a;
con=a;
int array[a];
for(a=0;a<con;a++)
cin>>array[a];
for(a=0;a<con;a++)
{
b=(array[a]*(array[a]-1)) / 2;
cout<<b<<endl;
}
}

Comments

Popular Posts