📄 program4_08.c
字号:
/* Program 4.8 While programming and summing integers */
#include <stdio.h>
int main(void)
{
long sum = 0L; /* The sum of the integers */
int i = 1; /* Indexes through the integers */
int count = 0; /* The count of integers to be summed */
/* Get the count of the number of integers to sum */
printf("\nEnter the number of integers you want to sum: ");
scanf(" %d", &count);
/* Sum the integers from 1 to count */
while(i <= count)
sum += i++;
printf("Total of the first %d numbers is %ld\n", count, sum);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -