单选题 C语言
题号 #2252732

 
下列程序的输出结果是( )。
#include<stdio.h>
main( )
{ int a=2,b=3,P;
p=f(a,b);
printf(”%d”,p);
}
int f(a,b)
{ int c;
if(a>b)c=1;
else if(a==b)c=0;
else c=-l;
return(c);
}

进入在线模考

参考答案

A

答案解析


本题考查if-else语句。if为真则执行C =1,if为假则执行else中的条件,不符合继续执行else。

你可能感兴趣的试题

找试题 · 找答案 · 找资料 在线模考