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

Write a C program that declares 3 1-D arrays names price, quantity, and amount.

ID: 3642055 • Letter: W

Question

Write a C program that declares 3 1-D arrays names price, quantity, and amount. Each array should be declared in main() and capable of holding 10 double-precision numbers. The number stored in price are 10.62, 14.89, 13.21, 16.55, 19.62, 9.47, 6.58, 19.32, 12.15, 3.99. The numbers stored in quantity are 4, 9.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, 4.9. Have the program pass the 3 arrays to a function called extend(), which calculates the elements in ammount as the product or price and quantity. amount[1]=price[1]*quantity[1]. After extend() has put the values in ammount, display the values froj within main(). Write the extend() function using pointers.

Explanation / Answer

#include void extend(float *p, float *q, float *amt); int main() { float prices[10]={10.62, 14.89, 13.21, 16.55, 19.62, 9.47, 6.58, 19.32, 12.15, 3.99}; float quantities[10]={4, 9.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, 4.9}; float amt[10]; extend(prices,quantities,amt); printf(" amouts in the array "); for(int i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote