问题只是找到三个数字中最大的一个。 我很确定,但系统显示“线程 1;断点 2.1” PS:我使用的是xcode...... 谢谢!
#include <stdio.h>
int main() {
int a ;
int b ;
int c ;
printf("Enter your first number\n") ;
scanf("%d",&a) ;
printf("Enter your second number\n") ;
scanf("%d",&b);
printf("Enter your third number\n") ;
scanf("%d",&c) ;
if (a>b & a>c) {
printf("%d is greatest\n",a) ;
}
if (b>a & b>c) {
printf("%d is greatest\n",b);
}
if (c>a & c>b) {
printf("%d is greatest\n",c);
}
return 0 ;
}
最佳答案
使用逻辑&&
代替按位&
。
if (a>b && a>c)
关于谁能告诉我这段代码有什么问题吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42179683/