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 is operator promotion?
When should the const modifier be used?
how to make a scientific calculater ?
Is c call by value?
What is meant by 'bit masking'?
What is #line?
Why is c platform dependent?
How are variables declared in c?
Explain the properties of union. What is the size of a union variable
Are local variables initialized to zero by default in c?
When we use void main and int main?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
Stimulate calculator using Switch-case-default statement for two numbers
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
Explain how can you determine the size of an allocated portion of memory?