# Find number of candidates in the Exam

Given the last rank ‘L’ and number of candidates at the last rank ‘T’, the task is to find the total number of candidates in Exam.

Input:L = 5, T = 1Output:5Input:L = 10, T = 2Output:11

**Approach:**

- Suppose L = 5 and T = 2.
- Then there can be many possible rank combinations, like 1, 2, 3, 3, 5, 5.
- So now in this, as you can see the last rank is 5 and there are 2 students at rank 5,
- Therefore, total number of candidates = 6.
- This can be understood by a simple formula:
**L+T-1**

Below is the Implementation of Above Approach.

## C++

`// C++ program to find total number of candidates ` `// in an Exam from given last rank ` `// and Number of student at this last rank. ` ` ` `#include <iostream> ` `using` `namespace` `std; ` ` ` `// Function to find total number of ` `// Participants in Exam. ` `int` `findParticipants(` `int` `L, ` `int` `T) ` `{ ` ` ` `return` `(L + T - 1); ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `int` `L = 10, T = 2; ` ` ` `cout << findParticipants(L, T); ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 program to find total number ` `# of candidates in an Exam from given last rank ` `# and Number of student at this last rank. ` ` ` `# Function to find total number of ` `# Participants in Exam. ` `def` `findParticipants(L, T) : ` ` ` ` ` `return` `(L ` `+` `T ` `-` `1` `); ` ` ` `# Driver code ` `if` `__name__ ` `=` `=` `"__main__"` `: ` ` ` ` ` `L ` `=` `10` `; T ` `=` `2` `; ` ` ` `print` `(findParticipants(L, T)); ` ` ` `# This code is contributed by AnkitRai01 ` |

*chevron_right*

*filter_none*

**Output:**

11

## Recommended Posts:

- Given number of matches played, find number of teams in tournament
- Find count of digits in a number that divide the number
- Find the number of ways to divide number into four parts such that a = c and b = d
- Find the other number when LCM and HCF given
- Find Nth number of the series 1, 6, 15, 28, 45, .....
- C++ Program to find sum of even factors of a number
- Find the sum of digits of a number at even and odd places
- Find the number after successive division
- Find the frequency of a digit in a number
- Program to find the number of men initially
- Program to find the Nth number of the series 2, 10, 24, 44, 70.....
- C program to Find the Largest Number Among Three Numbers
- Find if two people ever meet after same number of jumps
- Find the repeating and the missing number using two equations
- Number of matches required to find the winner

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.