Home > Back-end >  Refer to sprout new sprout new still don't know if I wrong in where, the code can run normally,
Refer to sprout new sprout new still don't know if I wrong in where, the code can run normally,

Time:11-18

# include
M double fac (int, int n) {
Int I, j, k, l, q, t;
Double s;
S=0;
L=1;
Q=1;
T=1;
For (I=1; i <=m; I++) {
L=l * I;
}
For (j=1; J & lt;=n; J++) {
Q=q * j;
}
For (k=1; K & lt;=(m - n); K++) {
T=t * k;
}
S=l/q/k;
Return s;
}
Int main () {
Long int m, n;
Scanf_s (ld ld, & amp; M, & amp; n);
If (m & lt; N & amp; & M> 0 & amp; & N & gt; 0 {
Printf (" 0 ");
return 0;
}
If (m==n & amp; & M & gt; 0 & amp; & N & gt; 0 {
Printf (" 1 ");
return 0;
}

If (m & gt; N & amp; & M & gt; 0 & amp; & N & gt; 0 {
Printf (" % lf ", fac (m, n));
return 0;
}
The else printf (" 1 ");
return 0;
}

CodePudding user response:

 # include 

M//double fac (int, int n)
Double fac (long int m, long int n)
{
Int I, j, k, l, q, t;
Double s;

S=0;
L=1;
Q=1;
T=1;

For (I=1; i <=m; I++) {
L=l * I;
}
For (j=1; J & lt;=n; J++) {
Q=q * j;
}
For (k=1; K & lt;=(m - n); K++) {
T=t * k;
}
S * 1.0=l/q/k;//that this arithmetic is of type double

Return s;
}
Int main ()
{
Long int m, n;
//scanf_s (ld ld, & amp; M, & amp; n);
Scanf_s (" % ld % ld ", & amp; M, & amp; n);

If (m & lt; N & amp; & M> 0 & amp; & N & gt; 0 {
Printf (" 0 ");
return 0;
}
If (m==n & amp; & M & gt; 0 & amp; & N & gt; 0 {
Printf (" 1 ");
return 0;
}

If (m & gt; N & amp; & M & gt; 0 & amp; & N & gt; 0 {
Printf (" % lf ", fac (m, n));
return 0;
}
The else
Printf (" 1 ");
return 0;
}

For your reference ~

//scanf_s (ld ld, & amp; M, & amp; n); 
Scanf_s (" % ld % ld ", & amp; M, & amp; n);

Compare the problems

Note:
 s * 1.0=l/q/k;//that this arithmetic is of type double 



M
//double fac (int, int n) 
Double fac (long int m, long int n)
  • Related