当输入数据:27 63 时,下面程序的运行结果是( )。 #include int gbs(int a, int b) { int c; a=a>0?a:-a; b=b>0?b:-b; c=a*b; if (c==0) return 0; while (a!=b) if (a>b) a-=b; else b-=a; return c/a; } int gys(int a, int b) { if (a*b==0) return 0; a=a>0?a:-a; b=b>0?b:-b; while (a!=b) if (a>b) a-=b; else b-=a; return a; } void main() { int a,b,c,d; scanf("%d%d",&a,&b); c=gbs(a,b); d=gys(a,b); printf("a=%d b=%d gbs=%d gys=%d ",a,b,c,d); }
举一反三
- 当输入数据:27 63 时,下面程序的运行结果是( )。 #include<stdio.h> int gbs(int a, int b) { int c; a=a>0?a:-a; b=b>0?b:-b; c=a*b; if (c==0) return 0; while (a!=b) if (a>b) a-=b; else b-=a; return c/a; } int gys(int a, int b) { if (a*b==0) return 0; a=a>0?a:-a; b=b>0?b:-b; while (a!=b) if (a>b) a-=b; else b-=a; return a; } void main() { int a,b,c,d; scanf("%d%d
- 以下程序的运算结果是_______。#include<;stdio.h>;int main( ){ int a=14, b=63;while (a!=b){ while (a>;b) a-=b;while (a<;b) b-=a;}printf (“%d\n”,a);return 0;}
- 以下程序的运行结果是:#include <;stdio.h>;int a=3, b=5;int max(int a, int b){int c;c=a>;b?a:b;return c;}int main(){int a=8;printf("%d\n", max(a, b));return 0;} A: 8 B: 5 C: 3 D: 0
- 假设输入5,10,以下程序运行的结果是( )。#include stdio.hint max(int a,int b){ if(a=b) return a; else return b;}int min(int a,int b){ if(a=b) return b; else return a;}void f(int a,int b,int(*p)(int,int)){ printf(%d\n,(*p)(a,b));}int main(){ int x,y; scanf(%d,%d,x,y); f(x,y,max); f(x,y,min); return 0;} A: 105 B: 55 C: 510 D: 1010
- 以下哪一个是正确的C语言程序结构? A: B: include int main() { return 0; } C: int main() D: include { return 0; } E: int main() { F: include return 0; } G: H: include int main() { } return 0;