厘米换算英尺英寸程序_使用C程序计算两个城市之间的距离,从公里到米,厘米,英尺和英寸...

厘米换算英尺英寸程序

Input the distance between two cities in kilometers, we have to calculate the distance in meters, feet, and inches.

输入以公里为单位的两个城市之间的距离 ,我们必须以米,英尺和英寸为单位计算距离

In the below program, we are taking input of the distance between two cities in kilometers and converting them into meters, centimeters, feet, and inches.

在下面的程序中,我们以公里为单位输入两个城市之间的距离,并将其转换为米,厘米,英尺和英寸。

For Example: If there are two cities "Gwalior" and "Delhi", their distance is 500 kilometers, after converting the distance from a kilometer, the distance value will be: 500000 meters, 1640420 feet, 19685050 inches, and 50000000 centimeters.

例如:如果有两个城市“ Gwalior”和“ Delhi”,它们的距离为500公里,则从一公里转换为距离后,距离值将为:500,000米,1640420英尺,19685050英寸和5000万厘米。

Here are the formulas:

公式如下:

    Meter       = km * 1000
    Feet        = km * 3280.84
    Inches      = km * 39370.1
    Centimeter  = km * 100000 

C程序,将距离从公里转换为米,英尺,英寸和厘米 (C program to convert distance from km to meters, feet, inches, and, centimeters)


/* 	calculate the distance in meter, feet, 
	inches and centimeter
*/

#include <stdio.h>

int main()
{
    /*Declare the variables*/
    int distance;
    float meter;
    float feet;
    float inches;
    float centimeter;

    /*input the value of distance through the keyboard*/
    printf("Enter the distance between Gwalior and Delhi (in KM): ");
    scanf("%d", &distance);

    /*  converting the distance into meters, feet, 
        inches, and, centimeter
    */
    meter = distance * 1000;
    feet = distance * 3280.84;
    inches = distance * 39370.1;
    centimeter = distance * 100000;

    /*printing the results*/
    printf("Meter = %f\n", meter);
    printf("Feet = %f\n", feet);
    printf("Inches = %f\n", inches);
    printf("Centimeters = %f\n", centimeter);

    return 0;
}

Output

输出量

First run:
Enter the distance between Gwalior and Delhi (in KM): 500
Meter = 500000.000000
Feet = 1640420.000000
Inches = 19685050.000000 
Centimeters = 50000000.000000

Second run:
Enter the distance between Gwalior and Delhi (in KM): 6
Meter = 6000.000000
Feet = 19685.039062
Inches = 236220.593750 
Centimeters = 600000.000000

Third run:
Enter the distance between Gwalior and Delhi (in KM): 1
Meter = 1000.000000
Feet = 3280.840088 
Inches = 39370.101562
Centimeters = 100000.000000 


翻译自: https://www.includehelp.com/c-programs/calculate-the-distance-between-two-cities-from-kilometers-to-other-units.aspx

厘米换算英尺英寸程序

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值