gpt4 book ai didi

c - 我的程序不会打印,输入数字后立即关闭(C)

转载 作者:行者123 更新时间:2023-11-30 16:56:18 25 4
gpt4 key购买 nike

#include <stdio.h>

int main()
{

int input, i, sum = 0;

printf("Please enter a number between 1 and 5: ");
scanf_s("%d", &input);

for (i = 0; i < 5; i++)
{
sum += input + i;
}

printf("Sum = %d\n", sum);

return 0;
}

当我打开它时,它会提出问题,但一旦我输入一个数字,它就会关闭,而不打印总和。

最佳答案

使用ctrl+F5运行程序。

关于c - 我的程序不会打印,输入数字后立即关闭(C),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39946730/

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