标题:求最后程序中getchar的作用
取消只看楼主
茯苓
Rank: 1
等 级:新手上路
帖 子:5
专家分:6
注 册:2013-9-20
结帖率:0
 问题点数:0 回复次数:0 
求最后程序中getchar的作用
#include <stdio.h>
main()
{
    int i,j,n;
    long sum=0,temp=0;

    printf("Please input a number to n:\n");
    scanf("%d",&n);
    if(n<1)
    {
        printf("The n must no less than 1!\n");
        return;
    }

    for(i=1;i<=n;i++)
    {
        temp=0;
        for(j=1;j<=i;j++)
            temp+=j;
        sum+=temp;
    }
    printf("The sum of the sequence(%d) is %d\n",n,sum);
    getchar();
    getchar();
搜索更多相关主题的帖子: number include 
2013-09-21 16:23



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-420864-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.877174 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved