1 solutions
-
0
C :
#include<stdio.h> int main() { double n; double sum=0; double pos=0, neg=0; double c = 0; while (scanf("%lf", &n) , n != 0.0) { c++; if (c>=10000) { break; } if (n>0) { pos++; } if (n<0) { neg++; } sum += n; } printf("%.0lf %.0lf ", pos, neg); printf("%.3lf\n", sum); }Pascal :
var b,c,n,i,o:longint; a:array[0..10000]of real; s:real; begin while not eof do begin o:=o+1; read(a[o]); if a[o]=0 then break; end; for i:=1 to o do begin if a[i]>0 then b:=b+1 else if a[i]<0 then c:=c+1; s:=s+a[i]; end; writeln(b,' ',c,' ',s:0:3); end.
- 1
Information
- ID
- 16634
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By