- #1
tandoorichicken
- 245
- 0
For a homework assignment I need to be able to read in a string of numbers and display them on the screen, and then use them in some calculations. How would be the best way to go about this?
Here's what I have so far to give you an idea of what I need to do:
int n;
double a[15];
printf("Here is the problem:\n");
printf("Enter the number of elements (<16): ");
scanf("%d", n);
printf("\nEnter %d double f-p numbers:\n", n);
Next the user enters 'n' float-point numbers on the screen, and I need to somehow scan that into a[]. How would I do this?
Here's what I have so far to give you an idea of what I need to do:
int n;
double a[15];
printf("Here is the problem:\n");
printf("Enter the number of elements (<16): ");
scanf("%d", n);
printf("\nEnter %d double f-p numbers:\n", n);
Next the user enters 'n' float-point numbers on the screen, and I need to somehow scan that into a[]. How would I do this?