# I need help

 Tomislav Keškić · February 3, 2015 Okay here's the code, for some reason it doesn't calculate the average correctly can someone help me?``#include #include #include #include #include int main(){    int i, howMany;    int total;    float average = 0.0;    int * pointsArray;    printf("How many numbers do you want to average:");    scanf("%d", &howMany);    pointsArray = (int *) malloc(howMany * sizeof(int));    printf("Enter them:\n");    for(i= 0; i

## Replies

 c student · February 5, 2015 ok, i see your problem.  you need to do some research on isdigit(), isalpha(), etc... Tomislav Keškić · February 4, 2015 ``#include #include #include int main(){    int i;    int howMany;    int total = 0;    float average =0.0;    int * pointsArray;    printf("Enter how many numbers do you want to average?");    scanf("%d", &howMany);    check:    if(isdigit(howMany)){    if(howMany <2){        printf("You need at least 2 numbers!\nTry again:");        scanf("%d", &howMany);        goto check;    }    pointsArray = (int *) malloc(howMany * sizeof(int));    printf("Enter the numbers:\n");    for(i=0; i
• 1

## C

129,732 followers