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
Answers were Sorted based on User's Feedback
include<stdio.h>
void main()
{
int miles;
double inch,feet;
long cm,km;
printf("Enter how many miles");
scanf("%d",&miles);
feet=5280*miles;
inch=feet*12;
cm=inch*2.54;
km=(cm/100000);
printf("Distance in KM:%lf"+km);
}
I did not compile the program,i wrote it directly
If there are any errors please specify........
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / sindhu
#include<stdio.h>
#include<conio.h>
main()
{
double km,mile;
printf(" enter distance in miles");
scanf("%f",&mile);
km=5280*12*2.54*100000*mile;
printf("
distance in km is %f",km);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / 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 |
What is the use of linkage in c language?
which is faster execution: loops or recursion?
Write a program to show the change in position of a cursor using c
How do I declare a pointer to an array?
How can I allocate arrays or structures bigger than 64K?
How can I sort a linked list?
being a chemical engineer and with an aggregate of 80% why you opt for TCS and not your core industry?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
Explain bit masking in c?
What is the difference between abs() and fabs() functions?
write a program to create a sparse matrix using dynamic memory allocation.
1 1 12 21 123 321 12344231 how i creat it with for loop??