This is a simple basic C program. it takes input from user at run time. The user enters the value of mm millimeters. These millimeters are then converted into inches by using the following formula:
How to convert mm millimeters to inches
1 millimeter = 0.03937007874 inches:
Therefore we will use the formula for converting mm to in:
inches = given millimetrs x 0.03937007874
Important Statements used in C program to convert mm into in
- Writing basic C program structure / template
- Declaring variables
- Using output statements like printf( ) function to display messages on screen
- This program uses scanf( ) function as input statement for getting user input at program execution time.
- This C program uses assignment statement for simple formula calculation.
The Source Code of C Program To Convert mm into inches is as Under
#include<stdio.h>
int main()
{
double mm, inches;
printf(“Enter millimetrs to be converted into Inches:”);
scanf(“%lf”, &mm);
inches = mm * 0.03937007874;
printf(“Inches are=%f”,inches);
return 0;
}