1 solutions
-
0
C :
#include<stdio.h> main() { int n,sum = 0; scanf("%d",&n); while(n > 0) { sum = sum + n; scanf("%d",&n); } printf("%d",sum); return 0; }Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int s=0,temp; while(sc.hasNext()){ temp=sc.nextInt(); if(temp<0||temp==0){ break; } s+=temp; } System.out.println(s); sc.close(); } }
- 1
Information
- ID
- 17260
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By