Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

write a c program to find out ncr factor of given number

#include <stdio.h>
int Cal_Fact(int);  
int main()
{
  int n, r, ncr; 
  printf("
 Please Enter the Values for N and R: 
");
  scanf("%d %d", &n, &r);
  ncr = Cal_Fact(n) / (Cal_Fact(r) * Cal_Fact(n-r));
  printf("
 NCR Factorial of %d and %d = %d", n, r, ncr);
  return 0;
}
int Cal_Fact(int Number)
{ 
  int i; 
  int Factorial = 1;
 
  for (i = 1; i <= Number; i++)
   {
     Factorial = Factorial * i;
   }
  return Factorial;
}
 
PREVIOUS NEXT
Tagged: #write #program #find #ncr #factor #number
ADD COMMENT
Topic
Name
5+9 =