#include int sub(int n) { if(n<5) return 0; else if(n>12) return 3; return 1; if(n>5) return 2; } int main() { int a=10; printf("%d\n",sub(a)); return 0;}
举一反三
- 以下程序的输出结果是______ 。#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;}
- 以下程序没有语法问题的是() A: B: include<;stdio.h>;int main( ){int x , y = 5 ; printf( "%d\n" , x / y ) ; return 0 ;} C: D: include<;stdio.h>;int main( ){int x = 3 ;y = 5 ; printf( "%d\n" , x / y ) ; return 0 ;} E: F: include<;stdio.h>;int main( ){int x = 3 ,y ; printf( "%d\n" , x / y ) ;y = 5; return 0 ;} G: H: include<;stdio.h>;int main( ){int x = 3 , y = 5 ; printf( "%d\n" , x / y ) ; return 0 ;}
- 以下程序的输出结果是_______。 int f(int n){ if(n<=1) return 0; n/=2; return f(n)+n; } int main(void){ printf("%d",f(7)); return 1; } A: 4 B: 3 C: 5 D: 6
- Which of the following program is right? A: include <stdio.h> int main(); { /*programming*/ printf("programming!\n"); return 0; } B: include <stdio.h> int main() { /*programming*/ printf("programming!\n"); return 0; } C: include <stdio.h> void main() { /*programming*/ printf("programming!\n") return 0; } D: include <stdio.h> int mian() { /*programming*/ printf("programming!\n"); return 0; }
- 下面程序的运行结果是15()。 #include int sub(int n) { int a; if(n==1) a=1; else a=n+sub(n-1); return(a); } void main() { int i=5; printf('%d ',sub(i)); }