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
What are the types of c language?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
How to Throw some light on the splay trees?
What is the difference between memcpy and memmove?
What is the purpose of type declarations?
What is a pointer in c?
What are the advantages of Macro over function?
What is the purpose of macro in C language?
Why doesnt the call scanf work?
What is "Hungarian Notation"?
how to create duplicate link list using C???
Explain how can you check to see whether a symbol is defined?
Differentiate abs() function from fabs() function.
Write the test cases for checking a variable having value in range -10.0 to +10.0?
I have a varargs function which accepts a float parameter?