5. distance conversion:
Convert a distance from miles to kilometers .there are 5280
feets per mile,12 inches per foot .2.54 centimeters per
inch and 100000centimeters per kilometer

Answer Posted / yogesh bansal

#include <stdio.h>
#define FEETS 5280
#define INCH 12
#define CENTIMETER 2.54
#define CMPERKM 100000
int main()
{
unsigned int miles=0;
unsigned feets;
unsigned inches;
double centimeter;
double KM;
printf("please enter the distance in miles\n");
scanf("%u",&miles);
feets = miles * FEETS;
printf("the distance in feets %u\n",feets);
inches = feets * INCH;
printf("the distance in inches %u\n",inches);
centimeter = inches * CENTIMETER;
printf("the distance in centimeter %fd\n",centimeter);
KM = centimeter/CMPERKM;
printf("the distance in KM %fd\n",KM);
return 0;
}

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the benefit of using #define to declare a constant?

601


How can you restore a redirected standard stream?

607


can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......

1402


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

869


How do you define structure?

563






Explain 'bus error'?

555


What is structure in c definition?

570


What does the error 'Null Pointer Assignment' mean and what causes this error?

738


How can a number be converted to a string?

595


What are directives in c?

539


Explain what are multibyte characters?

624


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

7387


Explain the properties of union. What is the size of a union variable

716


What is scope of variable in c?

558


Explain what is the heap?

618