写出以下程序的运行结果。#includeint x = 5, y = 7;void swap ( ){int z ;z = x ;x = y ;y = z ;}int main(void){int x = 3, y = 8;swap ( ) ;printf ("%d#%d", x , y ) ;return 0 ;}
查看答案
写出以下程序的运行结果。#include void Bin(int x){if (x/2 > 0)Bin(x/2);printf("%d#", x%2);}int main(void){Bin(12);return 0;}
写出以下程序的运行结果。#include int Try(int n){if(n>0) return(n*Try(n-2));else return 1;}int main(void){int i,x;for(i=1;i<5;i++){x=Try(i);printf("%d#",x);}return 0;}
写出以下程序的运行结果。#include int main(void){int i, max_sum, n, this_sum;int a[] = {-1, 3, -2, 4, -6, 1, 6, -1};scanf("%d", &n);max_sum = this_sum = 0;for( i = 0; i < n; i++ ){this_sum += a[i];if( this_sum > max_sum ) max_sum = this_sum;else if( this_sum < 0 ) this_sum = 0;}printf("%d", max_sum);return 0;}输入8,运行结果是________。输入5,运行结果是________。
写出以下程序的运行结果。#include int main(void){int i, n = 5, x;int a[10] = {1, 3, 5, 7, 9};scanf("%d", &x);for (i = n-1; i >= 0; i--){if(x < a[i]) a[i+1] = a[i];else break;}a[i+1] = x;printf("%d", i+1);return 0;}输入-5,运行结果是________。输入5,运行结果是________。