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 / 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 |
what is the code of the output of print the 10 fibonacci number series
main() { int a[10]; printf("%d",*a+1-*a+3); }
4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }
How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”)
main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }
why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?
PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }
Give a one-line C expression to test whether a number is a power of 2.
main() { char a[4]="HELLO"; printf("%s",a); }
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number