Run
// C++ program to find the maximum number of handshakesM
#include<iostream>
using namespace std;
int main()
{
//fill the code
int num = 9;
int total = num * (num-1) / 2; // Combination nC2
cout<<"For "<<num<<" people there will "<<total<<" handshakes";
return 0;
}
Output
For 8 people there will be 28 handshakes
#include
#include
using namespace std;
int main(){
int n=9,no_of_handshake=0;
for(int i=1;i<n;i++){
no_of_handshake+=n-i;
}
cout<<no_of_handshake;
return 0;
}