Program to find the maximum number of handshakes | The Handshakes Problem

Program to find the maximum number of handshakes | The Handshakes Problem

The program to find the maximum number of handshakes is discussed here. Given a positive integer n, find out the total number of handshakes possible.

program to find the maximum number of handshakes


DESCRIPTION

It was Raj’s first day at school. His teacher Anu asked the students to meet every other student in the class and introduce themselves. The teacher asked them to do handshakes when they met each other.

If there are n number of students in the class then find the total number of handshakes made by the students.

Input format and output format:

  • Input consists of 1 integer.
  • The first input corresponds to the total number of students.
  • The output consists of 1 integer.

Sample Input:

15

Sample output:

105


program to find the maximum number of handshakesClick here to learn more about FACE Prep PRO


Algorithm to find the maximum number of handshakes

  • Input the number of people (n).
  • Find nC2, calculated as n * (n-1) / 2.
  • Print the calculated result.

The program to find the maximum number of handshakes is given below

@@coding::1@@


program to find the maximum number of handshakesClick here to learn more about FACE Prep PRO


Recommended Programs


program to find the maximum number of handshakes

c