gpt4 book ai didi

c - 在 C 中帮助数学

转载 作者:太空宇宙 更新时间:2023-11-04 01:13:28 25 4
gpt4 key购买 nike

我需要知道如何让它在输入 0 时忽略数字 0,以便在输入 0 时程序不会退出。

#include <stdio.h>


int main()
{
int input = 0, previous = 0;


do {
previous = input;
printf("Input Number");
scanf("%d", &input);
} while( input!= previous*2 );

return 0;
}

最佳答案

previous 选择一个不同的值。尝试使用 limits.h 中的 INT_MAX >> 1

关于c - 在 C 中帮助数学,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6698846/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com