int Fate(int x);
int main(){
int m,k,p;
printf("m=");
scanf("%d",&m);
printf("k=");
scanf("%d",&k);
while (m<k)
{
printf("m must be greater than k, please re-enter\n");
printf("m=");
scanf("%d",&m);
printf("k=");
scanf("%d",&k);
}
p=Fact(m)/Fact(k)*Fact(m-k);
printf("p=%d\n",p);
system("pause");
return 0;
}
int Fact(int x){
int f=1;
if(x==0){
f=1;
}
else{
for(int i=1;i<=x;i++){
f*=i;
}
}
return f;
}
float Fun(float x,float y);
int main()
{
float x,y;
printf("please input two numbers:");
scanf("%f %f",&x,&y);
printf("The absolute value of the difference between the two numbers is %f\n",Fun(x,y));
system("pause");
return 0;
}
float Fun(float x,float y){
float z;
if(x>=y){
z=x-y;
}
else{
z=y-x;
}
return z;
}
来源:oschina
链接:https://my.oschina.net/u/4774086/blog/4784781