C/C++の宿題片付けます 141代目
■ このスレッドは過去ログ倉庫に格納されています
>>512
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int count = 0;
double total = 0.0;
/* コマンド行から複数の数値を受け取る */
if(argc <= 1) {puts("ERR"); return 1;}
for( argc--, count = 1; count <= argc; count++ ) {
total += atof(argv[count]);
}
count--;
printf("平均=%g\n", total/count);
}
■ このスレッドは過去ログ倉庫に格納されています