1.题目
三个球A、B、C,大小形状相同且其中有一个球与其他球重量不同。要求找出这个不一样的球。
输入格式:
输入在一行中给出3个正整数,顺序对应球A、B、C的重量。
输出格式:
在一行中输出唯一的那个不一样的球。
输入样例:
1 1 2
输出样例:
C
2.分析
if-else
3.代码
#include <stdio.h> int main() {
int Weight_A,Weight_B,Weight_C;
scanf("%d %d %d",&Weight_A,&Weight_B,&Weight_C);
if(Weight_A==Weight_B)
printf("C");
else if(Weight_A==Weight_C)
printf("B");
else if(Weight_B==Weight_C)
printf("A");
return 0; }
全用if
4.更新日志
2022.3.8 整理(C)