编程介的小学生 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;
    }

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料