Write a C program to find the maximum number of handshakes
Program:-
#include
int main()
{
//fill the code
int num;
scanf(“%d”,&num);
int total = num * (num-1) / 2; // Combination nC2
printf(“%d”,total);
return 0;
}
int main()
{
//fill the code
int num;
scanf(“%d”,&num);
int total = num * (num-1) / 2; // Combination nC2
printf(“%d”,total);
return 0;
}
Output:-
....
0 comments:
Post a Comment