Write A Program for calculating NCR using Functions

# include<stdio.h> #include<conio.h> void main ( ) { int n, r, ncr, a, b, c; clrscr( ) ; int fact ( int); pri...

# include<stdio.h>
#include<conio.h>
void main ( )
{
int n, r, ncr, a, b, c;
clrscr( ) ;
int fact ( int);
printf (“enter n, r values”);
scanf ("%d%d”, & n, & r);
a = fact (n);
b = fact (r);
c= fact (n-r);
ncr = a/b*c;
printf (“\n ncr value is %d”, ncr );
getch ( );
}

int fact ( int x)
{
int i, y=1;
for ( i = 1; i < = x; i ++)
y = y * i;
return ( y);
}

Related

C Programs 5603263976975450766

Post a Comment

emo-but-icon

item