#include<stdio.h>intmain(){int a, b;while(scanf("%d %d",&a,&b)!=EOF){if(a==0&& b==0)break;printf("%d\n", a + b);}return0;}
2
#include<stdio.h>intmain(){int a;while(scanf("%d",&a)!=EOF){if(a ==0)break;int sum =0;int tmp =0;for(int i =0; i < a; i++){scanf("%d",&tmp);
sum+=tmp;}printf("%d\n",sum);}return0;}
3
#include<stdio.h>intmain(){int n;scanf("%d",&n);for(int i =0; i < n; i++){int a;scanf("%d",&a);int sum =0;int tmp;for(int j =0; j < a; j++){scanf("%d",&tmp);
sum += tmp;}printf("%d\n",sum);}return0;}
4
#include<stdio.h>intmain(){int a;while(scanf("%d",&a)!=EOF){int sum =0;int tmp;for(int i =0; i < a; i++){scanf("%d",&tmp);
sum += tmp;}printf("%d\n",sum);}return0;}
5
#include<stdio.h>intmain(){int a;int sum =0;char ch;while(scanf("%d%c",&a,&ch)!=EOF){
sum += a;if(ch =='\n'){printf("%d\n",sum);
sum =0;}}return0;}
字符串类型输入输出
1
#include<stdio.h>#include<string.h>#include<stdlib.h>intmain(){int a;scanf("%d",&a);char arr[a][50];for(int i =0; i < a; i++){scanf("%s",arr[i]);}qsort(arr,a,50,strcmp);for(int i =0; i < a; i++){printf("%s ",arr[i]);}return0;}
2
#include<stdio.h>#include<string.h>#include<stdlib.h>intmain(){char arr[100][100]={0};int i =0;char ch =1;while(scanf("%s",arr[i])!=EOF){scanf("%c",&ch);//ch = getchar();
i++;if(ch =='\n'){qsort(arr,i,100,strcmp);for(int j =0; j < i; j++){printf("%s ",arr[j]);}printf("\n");
i =0;}}return0;}
3
#include<stdio.h>#include<string.h>#include<stdlib.h>intmain(){char arr[100]={0};char strarr[100][100]={0};int i =0;while(scanf("%s",arr)!=EOF){char* p =strtok(arr,",");while(p !=NULL){strcpy(strarr[i], p);
i++;
p =strtok(NULL,",");}qsort(strarr,i,sizeof(strarr[0]),strcmp);for(int j =0; j < i; j++){if(j == i -1)printf("%s\n",strarr[j]);elseprintf("%s,",strarr[j]);}
i =0;}return0;}