下列程序的输出结果是________。#include int f(int n){ if(n == 1) return 1; else return n + f(n - 1); } int main(void) { printf("%d\n", f(5)); return 0; }
查看答案
下列程序的输出结果是________。#include #define M 3 #define N M + 1 #define NN N * N / 2 int main(void) { printf("%d\n", NN); return 0; }
下列程序的输出结果是________。#include #define PI 3.14 #define S(x) PI * x * x int main(void) { int a = 2; printf("%.1f\n", 6.28 / S(a)); return 0;}
下列程序的输出结果是________。#include"stdio.h"#define N 10void f(void);int main(void){f();#ifdef N#undef N#endifreturn 0;}void f(void){#if defined(N)printf("N is %d\n", N);#elseprintf("N is undefined\n");#endif}
若有以下程序,函数 maxCommonFactor 利用欧几里德算法(辗转相除法)计算两个正 整数的最大公约数。1#include 2 int maxCommonFactor(int a, int b); 3 int main(void) { 4 int a, b, x; 5 printf("Input a, b:"); 6 scanf("%d%d", a, b); 7 x = maxCommonFactor(a,b); 8 printf("MaxCommonFactor=%d\n", x); 9 } 10 int maxCommonFactor(int a, int b) { 11 int r; 12 do { 13 r = a % b; 14 a = b; 15 b = r; 16 } while(r != 0); 17 return a; 18 }程序中存在的错误在第________行。