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.
Answer Posted / jeeva kumar
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,a,b,c=1,d=1;
printf("Enter the tot no of people");
scanf("%d", &n);
printf("In how many they have to form group");
scanf("%d", &a);
b=a;
for(i=0;i<b;i++)
{
c*=n;
d*=a;
n--;
a--;
}
printf("%d",c/d);
getch();
}
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
What do you mean by a local block?
List the difference between a "copy constructor" and a "assignment operator"?
Explain how do you override a defined macro?
Why is sizeof () an operator and not a function?
Describe the header file and its usage in c programming?
What is the purpose of realloc()?
Can we compile a program without main() function?
What is pass by reference in c?
When should the volatile modifier be used?
Why do we use c for the speed of light?
Why is c not oop?
write a program to concatenation the string using switch case?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
What is binary tree in c?
What are the different types of linkage exist in c?