输出练习收获
来源:互联网 发布:易语言制作下载器源码 编辑:程序博客网 时间:2024/06/10 03:39
while(scanf("%d%d",&a,&b)!=EOF)
scanf("%d%d\n",&a,&b);
scanf("%d%d\n",&a,&b);使用scanf需要换行时不要加\n,不然下一行printf不能输出结果
while((scanf("%d",&n))!=EOF,n)
while((scanf("%d",&n))!=EOF&&n) 功能相同,n不等于0,且还在继续输入
For each group of input integers you should output their sum in one line, and you must note that there is a blank line between outputs.
对于每一组输入整数,你应该在一行输出它们的和,你必须注意输出之间有一条空行。#include<stdio.h>
int main(){
int a,s,i,n;
scanf("%d",&n);
while(n--){
s=0;
scanf("%d",&a);
while(a--){
scanf("%d",&i);
s+=i;
}
printf("%d\n",s);
if(n!=0){
printf("\n");
}
}
} 并且最后一行结束不能再有空行 if(n!=0){
printf("\n");
}
For each pair of input integers a and b you should output the sum of a and b, and followed by a blank line.
对于每对输入整数a和b,你应该输出a和b的和,然后是一条空行。 此描述不用再加if判断了阅读全文
1 0
- 输出练习收获
- 编程练习收获
- 今天多线程编程练习中的一些收获
- Servlet 输出中文乱码的新收获
- Servlet 输出中文乱码的新收获
- Servlet 输出中文乱码的收获(1)
- Servlet 输出中文乱码的新收获
- Servlet 输出中文乱码的新收获
- 收获
- 收获
- 收获
- 收获
- 收获
- 收获
- 收获
- 收获
- 收获
- 收获
- 安卓学习笔记---ScrollView中嵌套recycleView 出现的不显示,显示不全,终极解决方案
- Android安全攻防战,反编译与混淆技术完全解析(上)
- 改变TimePickerDialog
- 图解 leetCode 74.Search a 2D Matrix(搜索二维矩阵)
- 多线程基础知识
- 输出练习收获
- WebView加载网页及进度条
- Hibernate——load方法和get方法的异同
- 详解CSS3中:nth-child的用法
- linux目录详解
- Docker在搭建过程中遇到的几个报错信息
- lordPE转自http://blog.sina.com.cn/s/blog_6e8f83bc01014115.html
- 被偷走那三年
- 多态 接口