程序填空,使下面程序实现输出N!(N<=10000)的最低三位。#include <stdio.h>int main(){int N,M=1;scanf("%d",&N);for (int i=1;i<=N;i++){M=M*i;M=__________;}printf("%03d",M);return 0;}?
举一反三
- 写出下面程序执行后的运行结果。#include <stdio.h>int main(){int i,n[]={0,0,0,0,0};for(i=1;i<=4;i++) {n[i]=n[i-1]*2+1;printf("%d:",n[i]);} return 0;}?
- 以下程序中,运行结果是36的有()。 A: B: include <stdio.h> C: define M(y) y*y int main() { printf("%d ",M(6+0)); return 0; } D: E: include <stdio.h> F: define M(y) (y)*(y) int main() { printf("%d ",M(6+0)); return 0; } G: H: include <stdio.h> int M(int y) { return y*y; } int main() { printf("%d ",M(6+0)); return 0; } I: J: include <stdio.h> int M(int y) { return (y)*(y); } int main() { printf("%d ",M(6+0)); return 0; }
- 有以下程序prt(int *m,int n){ int i; for(i=0;i<n;i++) m[i]++;}main(){ int a[]={1,2,3,4,5},i; prt(a,5); for(i=0;i<5;i++) printf("%d,",a[i]);}程序运行后的输出结果是:[/i][/i] A: 1,2,3,4,5, B: 2,3,4,5,6, C: 3,4,5,6,7, D: 2,3,4,5,1,
- 以下程序的功能是计算:m=1-2+3-4+…+9-10,并输出结果。请填空。 main { int m = 0, f = 1, i, n; scanf("%d", &n); for(i = 1; i <= n; i++) { m += i * f; f= ; } printf("m=%d", m) }
- 下面程序尝试使用空间换取时间的策略实现第1至100项中任意菲波那切数列的求解,请填空完善程序。# include <stdio.h># define N 100int fab[N]={-1};int Fab(int n){if (___________){if ((n==1)||(n==2))fab[n]=1;elsefab[n]=Fab(n-1)+Fab(n-2);}return fab[n];}int main(){int n;scanf("%d",&n);printf("%d",Fab(n));return 0;}?