Computer Science, asked by manoj2425, 10 months ago

t was Raj's first day at school. His teacher Anu asked the students to meet every other student in the class and introduce about themselves. The teacher asked them to handshake with each other when they meet. If there are n number of students in the class then find the total number of handshakes made by the students.

Answers

Answered by nidhinawale7
4

Answer:

#include<iostream>

 int main()

{

 int a,n;

 std::cin>>n;

 a=(n*(n-1))/2;

   std::cout<<a;

}

Explanation:

Answered by shreta4567
0

Answer:

here the exact number of students is not given. So, considering a test case with n=10.

The total number of handshakes will be = 45

Explanation:

i'm giving a C program for better understanding

#include <stdio.h>

int main()

{

int n, handshakes;

printf("enter the no.of students: ");

scanf("%d",&n);

handshakes= (n*(n-1))/2 ;

printf("no. of handshakes are: %d\n", handshakes);

}

OUTPUT:

Enter the no.of students: 10

no. of handshakes are: 45

#SPJ3

Similar questions