下列程序运行后的输出结果为。
# include
int num;
void fun
{
printf ( "%d, ", num );
}
int main
{
int num = 3;
fun ;
printf ( "%d,", num );
return 0;
}
# include
int num;
void fun
{
printf ( "%d, ", num );
}
int main
{
int num = 3;
fun ;
printf ( "%d,", num );
return 0;
}
举一反三
- 分析下列程序,写出运行结果。#includeint fun( int num ){ int k=1; while(num){ k=k* (num%10); num=num/10; } return k;}int main(){ int x=255; printf("x=%d\n",fun(x));}程序的运行结果是:______
- 下面程序的输出结果是( )。#include <;stdio.h>;int num=10;int func(){int num=4;return ++num;}int main(){printf("%d\n",func());return 0;} A: 1 B: 4 C: 5 D: 10
- 以下程序的输出结果是#include<;stdio.h>;int fun6(int num){ int k=1;do{ k*=num%10; num/=10;}while(num);return k;}main( ){ int n=26;printf(“%d\n”,fun6(n));}
- 以下程序输出结果为:#include<;stdio.h>;int num(int x,int y){int a,b;a=x+y;b=x-y;}int main(){int a=3,b=2;int x,y;x=a+b;y=a-b;num(a,b);printf("%d",a);return 0;}
- 以下程序段的输出结果是 。 int main(void) { int num = 0,s = 0; while(num <= 2){ num++; s += num; } printf("%d\n",s); return 0; }