Update 2022-12-10 08:14 OpenBSD/amd64
This commit is contained in:
parent
ad6f13c9bf
commit
e10f23b8eb
10
.bin/avg.c
10
.bin/avg.c
@ -4,15 +4,15 @@
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
double no = 0;
|
||||
for (int i=0; i<argc; i++) {
|
||||
no += atoi(argv[i]) / 1000000;
|
||||
unsigned long long no = 0;
|
||||
for (int i=1; i<argc; i++) {
|
||||
no += strtoull(argv[i], NULL, 10) / 1000000;
|
||||
}
|
||||
if (argc < 2)
|
||||
printf("%f\n", no);
|
||||
printf("%lld\n", no);
|
||||
|
||||
if (argc > 1)
|
||||
printf("%.0f\n", no / (argc - 1));
|
||||
printf("%.0lld\n", no / (argc - 1));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user