1 solutions
-
0
C :
#include <stdio.h> main() { int a,b; while(scanf("%d%d",&a,&b)&&(a||b)) { printf("%d\n",a+b); } return 0; }C++ :
#include <iostream> #include <cstdio> int main() { int a, b; while (scanf("%d%d", &a, &b) != EOF) { if (a == 0 && b == 0) break; printf("%d\n", a + b); } return 0; }Pascal :
program p1002; var a,b:longint; begin while not eof do begin readln(a,b); if not((a=0) and (b=0)) then writeln(a+b); end; end.Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { final int MAX=1024; int i = 0; @SuppressWarnings("resource") Scanner in = new Scanner(System.in); int[] a =new int[MAX]; int[] b =new int[MAX]; a[i] = in.nextInt(); b[i] = in.nextInt(); while(a[i] != 0 && b[i] != 0){ i++; a[i] = in.nextInt(); b[i] = in.nextInt(); } for(int j = 0; j < i; j++){ System.out.println(a[j]+b[j]); } } }Python :
import sys for line in sys.stdin: a = line.split() if int(a[0]) !=0 and int(a[1]) !=0: print int(a[0]) + int(a[1])
- 1
Information
- ID
- 18213
- Time
- 1000ms
- Memory
- 32MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By