编程介的小学生 2019-03-30 17:47 采纳率: 20.5%
浏览 449

输入的数字按要求求和的算法,利用C语言的程序设计的语言的解决做法

Problem Description
Write a program to determine the summation of several sets of integers.

Input
The input file will consist of up to 250 sets of integers, where each set contains at most 100 integers and the integer values will be between –16000 and + 16000. Each set of numbers is started with the number of integers in the set, n. The next n input lines will each contain one integer of the set. You should stop processing when the size of the set, n, is<= 0.

Output
A single line of output should be generated for each set of integers. The line should have format shown below.

Sample Input
4
-1
3
1
1
2
19
17
5
-645
952
-1488
-5456
-9342
-1

Sample Output
Sum of #1 is 4
Sum of #2 is 36
Sum of #3 is -15979

  • 写回答

1条回答 默认 最新

  • _听风 2019-03-31 11:18
    关注

    sum(int a; int b)
    {
    int s = 0;
    s = a+b;
    return s;
    }

    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大