Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need working code converted to accept float values into an array of type float

ID: 3532817 • Letter: I

Question

I need working code converted to accept float values into an array of type float instead of int values. The output should be able to reverse the order of elements into the array of type float.


Here is what I am working with:


#include <stdio.h>

int main()

{

int n, c, d, a[100], b[100];

printf("Enter the number of elements in array ");

scanf("%d", &n);

printf("Enter the array elements ");

for (c = 0; c < n ; c++)

scanf("%d", &a[c]);

/*

* Copying elements into array b starting from end of array a

*/

for (c = n - 1, d = 0; c >= 0; c--, d++)

b[d] = a[c];

/*

* Copying reversed array into original.

* Here we are modifying original array, this is optional.

*/

for (c = 0; c < n; c++)

a[c] = b[c];

printf("Reverse array is ");

for (c = 0; c < n; c++)

printf("%d ", a[c]);

return 0;

}

Explanation / Answer

http://ideone.com/XP2AaX



let me know if you require any further help