I'm kinda stuck on what to do, basically the user can input as many inputs as he/she wants to (within reasonable amount) and the program is supposed to calculate the avg, simple enuff. But I can't get it working.. heres wat I tried so far..

The problem lies in me receiving input from the scanf() function into an array.. any suggestions?Code:#include <stdio.h> #include <stdlib.h> int main() { float num[30]; int n = 0; float total = 0, avg = 0; printf("Input numbers separated by a space: "); // Input numbers for (n = 0; (num[n] != '\n'); n++) { scanf("%d ",&num[n]); } // Total numbers for (n = 0; (num[n] != '\n'); n++) { total += num[n]; } avg = total / ((float)n); printf("The average number was: %f",total); return 0; }