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

Write a program that contains the function measure() that is to accept a long in

ID: 3653833 • Letter: W

Question

Write a program that contains the function measure() that is to accept a long integer number total and the addresses of the integer variables inches, feet, yards, and miles. The passed long integer represents the total number of inches, and the function is to determine the number of miles, yards, feet, and inches in the passed value, writing these values directly into the respective variables declared in the calling function. This function will be called from the main program and when it returns to main, it will print out the values of inches, feet, yards, and miles. Use the relationships: inch foot (12 inches) yard (36 inches; 3 feet) mile (5280 feet; 1760 yards; 63,360 inches)

Explanation / Answer

#include #include int measure(int inch,int *y,int *f,int *m, int *i) { int total; int m_count = 0,y_count=0,f_count=0, i_count=0; total = inch; m_count = total/ 63360; total = total%63360; y_count = total /36; total = total%36; f_count = total/12; total = total%12; i_count = total; *m = m_count; *y = y_count; *f = f_count; *i = i_count; return 0; } int main() { int m,y,f,i; int l; /*user enteredlength */ printf(" Enter the length(in inches): "); scanf("%d",&l); measure(l,&m,&y,&f,&i); printf(" The breakdown for %d inches is miles =%d, yards = %d, feet = %d, inches = %d", l,m,y,f,i); getch(); return 0; }
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