Computer Science, asked by sudhanshuank2016, 8 days ago

2. The distance between two cities (in kms) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters. Solve this in C++ language.​

Answers

Answered by robartcryme
2

Explanation:

EASTER SCIENCE

HomepageProgrammingC language

Lokesh Kumar in C languageC SolutionChapter 1Programming

Q2 The distance between two cities (in km.) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters.

Let Us C Solutions 2

Let Us C Solutions 2

Program: 52

Write a program to convert the distance from km to m,cm,feet and inches. | Let Us C Solutions

#include<stdio.h>

int main()

{

float km, m, cm, f, in;

printf("Enter distance in kilometers: ");

scanf("%f",&km);

/* Calculate the conversion */ m = 1000 * km;

cm = 1000 * 100 * km;

f = 3280.84 * km;

in = 39370.08 * km;

printf("The distance in Feet: %f\n", f);

printf("The distance in Inches: %f\n", in);

printf("The distance in Meters: %f\n", m);

printf("The distance in Centimeters: %f\n", cm);

return (0);

}

please mark me brainlist

Answered by sudiptakotal02
0

Explanation:

Program:

Write a program to convert the distance from km to m,cm,feet and inches.

#include<stdio.h>

int main()

{

float km, m, cm, f, in;

printf("Enter distance in kilometers: ");

scanf("%f",&km);

/* Calculate the conversion */ m = 1000 * km;

cm = 1000 * 100 * km;

f = 3280.84 * km;

in = 39370.08 * km;

printf("The distance in Feet: %f\n", f);

printf("The distance in Inches: %f\n", in);

printf("The distance in Meters: %f\n", m);

printf("The distance in Centimeters: %f\n", cm);

return (0);

}

Output:

Enter distance in kilometers: 2

The distance in Feet: 6561.680176

The distance in Inches: 78740.156250

The distance in Meters: 2000.000000

The distance in Centimeters: 200000.000000.

Similar questions