# C Program to Convert Inches to Centimetres

In this tutorial, we will learn about how to create a program in C that will ask from user to enter length (in Inch) to convert and print its equivalent length into centimetre. But before going through the program given below, let's first understand about the relation between inch and centimetre.

### Inch and Centimetre Relation

The relation between inch and centimetre is either written as:

`1 centimetre = 0.3937 inches`

or,

`1 inch = 2.54 centimetre`

Note - The spelling, centimetre is used as International spelling, whereas centimeter is used as American spelling

Note - A centimetre is equal to one hundredth of a meter.

Centimetre is represented or abbreviated as (cm), whereas inches is represented as (" or in). Therefore, we can write:

`1" = 2.54 cm`

Now let's move on to the program.

## Inch to Centimetre in C

The question is, write a program in C that converts length from inch to centimetre. The answer to this question is given below:

```// Inche to Centimetre Conversion Program in C
// -----------codescracker.com-----------

#include<stdio.h>
#include<conio.h>
int main()
{
float inch, cm;
printf("Enter length in Inch: ");
scanf("%f", &inch);
cm = inch * 2.54;
printf("Equivalent length in Centimetres = %0.2f", cm);
getch();
return 0;
}```

As the above program was written under Code::Blocks IDE, therefore after successful build and run, here is the snapshot of sample run:

Now supply any length in inch say 12 and press ENTER key to see the same length in centimetre. Here is the second snapshot of the sample run:

Here are some of the main steps used in above program:

• Receive any length in Inch
• As 1 inch is equal to 2.54 cm
• Therefore to convert any length given in inch, we have to multiply it with 2.54 to convert it into centimetre
• Print the length after converting in centimetre as output
• Here we have used the format specifier of floating-point as %0.2f to print the value upto its 2-decimal place