大神们这个哪里错了啊
#include <stdio.h>int main()
{
int a, b;
printf("please show two number: ");
scanf("%d %d", &a , &b);
if (a != b)
{
if (a > b)
{
printf("%d > %d\n", a, d);
}
else
{
printf("%d < %d\n", a, b);
}
}
else
{
printf("%d = %d\n", a, b);
}
return 0;
}
认真一点就不会有这个问题
#include <stdio.h>
int main()
{
int a, b;
printf("please show two number: ");
scanf("%d %d", &a , &b);
if (a != b)
{
if (a > b)
{
//printf("%d > %d\n", a, d);
printf("%d > %d\n", a, b);
}
else
{
printf("%d < %d\n", a, b);
}
}
else
{
printf("%d = %d\n", a, b);
}
return 0;
}
本帖最后由 jackz007 于 2021-11-6 23:48 编辑
scanf("%d %d", &a , &b);
if (a != b)
{
if (a > b)
{
printf("%d > %d\n", a, d); 纯粹复习
C 代码:#include <stdio.h>
int main()
{
int a, b;
printf("Please enter 2 numbers: ");
scanf("%d %d", &a, &b);
a > b ? printf("%d > %d", a, b) : a < b ? printf("%d < %d", a, b) : printf("%d = %d", a, b);
return 0;
}C++ 代码:#include <iostream>
int main()
{
int a, b;
std::cout << "Please enter 2 numbers: ";
std::cin >> a >> b;
a > b ? std::cout << a << " > " << b << std::endl : a < b ? std::cout << a << " < " << b << std::endl : std::cout << a << " = " << b << std::endl;
return 0;
}Python 代码:a, b = map(int, input("Please enter 2 numbers: ").split())
print(f"{a} > {b}" if a > b else f"{a} < {b}" if a < b else f"{a} = {b}")
页:
[1]