[My site ]
Main » 2013 » December » 13 » 2007-2008 question 3
0:15 AM
2007-2008 question 3
write program calculate
z = x^y(x!+y!)/(x!-y!)

#include"stdio.h"
float factorial(float k);
float power(float m, float n);
main()
{
float x, y, z;
printf("enter x : ");
scanf("%f", &x);
printf("enter y : ");
scanf("%f", &y);
z = power(x,y)*(factorial(x)+factorial(y))/(factorial(x)-factorial(y));
printf("Z = %.2f", z);
getch();
return 0;
}
float factorial(float k)
{
int i, fact=1;
for(i=1;i<=k;i++)
fact*=i;
return fact;
}
float power(float m, float n)
{
int i, p=1;
for(i=1;i<=n;i++)
p*=m;
return p;
}
Category: C Programming - 1 | Views: 516 | Added by: ahansaary | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Sign Up | Login ]