Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

question is to write a short program that uses a for loop to populate an array. The array can store up to 10 integers. However the catch is other students put a bug in the program for it to not run as designed.

question is to write a short program that uses a for loop to populate

an array. The array can store up to 10 integers. However the catch is other students put a bug in the program for it to not run as designed.

the code:// C code
// This program will calculate
// how many miles were run over a given week in total.
// Developer: Huffaker Jordan M
// Date: Jul 11,2020
// This code is used to populate an array with the contents provided from a users input floats.
#include <stdio.h>
int main () {
// variable definition:
float myArray[10], inputFromUser;
int i,j, numberOfElements;
//Query user for number of elements in the Array
printf(“Enter the number of elements that you will have in your array: “);
scanf(“%f”, &numberOfElements);
// initialize elements of array
for ( i = 0; i < numberOfElements; i++ ) {
printf(“Enter array element number %d:\n” , i+1);
scanf(“%f”, &inputFromUser);
myArray[i] = inputFromUser; /* set element at location i to i + 100 */
}
printf(“Here is your array displayed below.\n”);
for ( i = 0; i< numberOfElements; i++ ) {
printf(“%f “, myArray[i]);
}
return 0;
} // end main

please help me fix this code

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"