Today we will write a C language program to convert person height from inches to centimeters. This is a simple formula calculation program. The following is the formula:
centimeters = inches x 2.54.
/* C Program to convert person's height from inches to centimeters using formula 2.54 * height */ #include<stdio.h> int main() { float inchesHeight, centiHeight; printf("Enter Person Height in inches ="); scanf("%f", &inchesHeight); centiHeight = inchesHeight * 2.54; printf("Height of Person in Centimeters =%.2f", centiHeight); return 0; }
Here is an image explaining the execution of this program: