Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write program in C/C++/Java and explain the steps for every logic of program because i am not understanding and getting confused. The question for

Please write program in C/C++/Java and explain the steps for every logic of program because i am not understanding and getting confused.

The question for the program is as follows :

At the annual meeting of Board of Directors of Acme Inc, every one starts shaking hands with everyone else in the room. Given the fact that any two persons shake hand exactly once, Can you tell the total count of handshakes?

Input Format The first line contains the number of test cases T, T lines follow. Each line then contains an integer N, the total number of Board of Directors of Acme.

Output Format

Print the number of handshakes for each test-case in a new line.

Constraints

1 <= T <= 1000 0 < N < 106

Sample Input

2 1 2 

Sample Output

0 1 

Explanation

Case 1 : The lonely board member shakes no hands, hence 0. Case 2 : There are 2 board members, 1 handshake takes place.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

What are the major social responsibilities of business managers ?

Answered: 1 week ago

Question

What are the skills of management ?

Answered: 1 week ago