1) You don' t need argc, argv (they are another "story" and have no use in this code).
2) it is very complicated as you wrote it(for me).
if you want take a look at this
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define size 5 //My code is for 5 numbers but you can easily change it
int main (void){
int i, r, n=0, j, temp=0;
float sum=0;
srand(time(NULL));
for (i=1; i<=15; i++){
for(j=0; j<size; j++){
r = 0 + rand()%(size-0);
printf("Rand: %d\n", r);
//printf("i: %d\n", i);
temp =pow(r,i); // i use for my first time pow() and there is a problem with i...if anyone else knows please tell
printf("temp: %d\n", temp);
sum = sum+r;
n++;
}
printf("Sum is: %f\n", sum);
printf("Average: %f\n", sum/n);
}
return 0;
}
i hope this is closer to what you want...