# TCS NQT ROUND TABLE CONFERENCE CODING PROBLEM

We at gradjobopenings.com provide free job alerts of freshers job drives. In this website we list on campus job openings for freshers and off campus job openings for freshers and also work from home job openings. This is the best website to apply for off campus drive in India. Visit our website for government job alerts and private job alerts. We also list free interview notes and study materials, one of the best interview study website.comfortable to face the interviews:

An international round table conference will be held in India. Presidents from all over the world representing their respective countries will be attending the conference. The task is to find the possible number of ways(P) to make the N members sit around the circular table such that.

The president and prime minister of India will always sit next to each other.

**Input format**

– First line: A non-negative integer N indicating the number of members.

**Output format**

– First line: A positive integer number.

**Example 1:**

– Input: 4   -> Value of N(No. of members)

– Output: 12  -> Possible ways of seating the members

– Explanation: 2 members should always be next to each other. So, 2 members can be in 2! ways. The rest of the members can be arranged in (4-1)! ways. (1 is subtracted because the previously selected two members will be considered as single members now). So total possible ways 4 members can be seated around the circular table 2*6= 12. Hence, the output is 12.

**Example 2:**

– Input: 10  -> Value of N(No. of members)

– Output: 725760 -> Possible ways of seating the members

– Explanation: 2 members should always be next to each other. So, 2 members can be in 2! ways. The rest of the members can be arranged in (10-1)! Ways. (1 is subtracted because the previously selected two members will be considered as a single member now). So, the total number of possible ways 10 members can be seated around a round table is 2*362880 = 725760 ways. Hence, the output is 725760.

**Constraints:**

2<=N<=50

**Program in C**

``````#include <stdio.h>
#include <math.h>

// size_t fact (size_t n) {
//     size_t fac = 1;
//     while (n > 1)
//         fac *= n --;
//     return fac;
// }

int main() {
size_t n;
scanf("%lu", &n);
// printf("%lu", 2 * fact(n - 1));
printf("%.0f", 2 * tgamma(n));
return 0;
}
``````

Program in C++

``````#include <iostream>
#include <cmath>
// size_t fact (size_t n) {
//     size_t fac = 1;
//     while (n > 1)
//         fac *= n --;
//     return fac;
// }

int main() {
size_t n;
std::cin >> n;
// std::cout << 2 * fact(n - 1);
std::cout << 2 * tgamma(n);
return 0;
}
``````

Program in Java

``````import java.util.*;

class Main
{
static int fact(int n)
{
int fact = 1;
while (n > 1)
fact *= n--;
return fact;
}

public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
in.close();
System.out.print( 2 * fact(n-1));
}
}
``````

Program in Python

``````if __name__ == '__main__':
import math
print(2 * math.factorial(int(input()) - 1), end = '')
``````