Skip to content
Home » C Program to Convert Inches to Centimetre

C Program to Convert Inches to Centimetre

Learn about C Program to Convert Inches to Centimetre in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

C Program to Convert Inches to Centimetre

Because 1 inch equals 2.54 centimetres. To convert any length provided in inch, multiply it by 2.54 to get it in centimetres. As an output, print the length after converting it to centimetres. To print the value up to the second decimal place, we used the floating-point format specifier percent 0.2lf.

Program:

#include<stdio.h>
int main()
{
   double inch, cm;

   printf("Enter Inches: ");
   scanf("%lf",&inch);

   cm = 2.54*inch;
   printf("Centimeters= %.2lf\n",cm);

   return 0;
}

Output:

Enter Inches: 5
Centimeters= 12.70

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C Program to Find Range of Data Types
Size of Structure data type