There are 21 people in a room. They have to form groups of 3
people each. How many combinations are possible? Write a C
program to print the same.



There are 21 people in a room. They have to form groups of 3 people each. How many combinations are..

Answer / jagadeesh

#include<stdio.h>
long int fact(long int n);
void main()
{
long int p;
p=fact(21)/(fact(18)*fact(3));
printf("%ld",p);
}
long int fact(long int n)
{
if(n==0||n==1)
return 1;
else
return n*fact(n-1);
}

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }

2 Answers  


Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

1 Answers  


How to read a directory in a C program?

4 Answers  


All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,


How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”)

4 Answers   HCL,






Write a C program to print look and say sequence? For example if u get the input as 1 then the sequence is 11 21 1211 111221 312211 12112221 .......(it counts the no. of 1s,2s etc which is in successive order) and this sequence is used in run-length encoding.

1 Answers  


#define a 10 void foo() { #undef a #define a 50 } int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } explain the answer

1 Answers  


#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }

3 Answers  


What is the output for the following program main() { int arr2D[3][3]; printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0])) ); }

1 Answers  


Finding a number which was log of base 2

1 Answers   NetApp,


Write a single line c expression to delete a,b,c from aabbcc

2 Answers   Microsoft,


How will u find whether a linked list has a loop or not?

8 Answers   Microsoft,


Categories