C
Programming and Technical
Programming
Technical
Write a program that lets you enter a distance in kilometers and that converts it into miles. The conversion factor is that 1 mile = 1.6093 kilometers. Write your own method to do the conversion and return the answer to the main program.
Read Solution (Total 8)
-
- #include
float convert(float);
int main(void) {
float km,mile;
scanf("%f",&km);
mile=convert(km);
printf("%f",mile);
return 0;
}
float convert(float km)
{
float mile;
mile=km*0.62137119;
return mile;
} - 10 years agoHelpfull: Yes(9) No(0)
- #include
double converttomile(double);
int main()
{
double km,mile;
printf("Enter the ditance in kilometres: ");
scanf("%f",&km);
mile=converttomile(km);
printf("Converted distance in mile is: %f miles",mile);
return 0;
}
double converttomile(double kilometre)
{
return (1.6093*kilometres);
}
- 10 years agoHelpfull: Yes(1) No(0)
- #include
#include - 10 years agoHelpfull: Yes(0) No(2)
- #include
#include
main()
{ float dist, conv;
printf("
enter the distance in km:");
scanf("%f",&dist)
conv=1.6093*dist;
printf("
the distance is %f miles",conv);
return(conv);
} - 10 years agoHelpfull: Yes(0) No(0)
- #incude
main()
{
float m,k;
printf("enter value in kilometers");
scanf("%d",k);
m=1.6093*k;
printf("f",m);
} - 10 years agoHelpfull: Yes(0) No(0)
- #include
#include
void main()
{
double mile;
printf("Enter distance in mile");
scanf("%lf",&mile);
printf("%lf miles = %lf kilometers",mile,(mile*1.6093));
getch();
} - 10 years agoHelpfull: Yes(0) No(0)
- #include
float conversion(float km);
int main()
{
float km,miles;
printf("Enter distance in km: ");
scanf("%f",&km);
miles=conversion(km);
printf("%f km = %f miles",km,miles);
return 0;
}
float conversion(float km)
{
float x=km/1.6093;
return x;
} - 10 years agoHelpfull: Yes(0) No(0)
- #include
float convert(float);
int main()
{
float mile,km;
scanf("%f" , &km);
mile= convert(km);
printf("%f", mile);
return 0;
}
float convert(float km);
{
float mile;
mile = km*1.6093;
return mile;
}
- 9 years agoHelpfull: Yes(0) No(0)
C Other Question