In this tutorial you will learn about the C Program to Convert Inches to Centimeters and its application with practical example.
C Program to Convert Inches to Centimeters
In this tutorial, we will learn to create a C program that will Convert Inches to Centimeters in C programming.
Before starting with this tutorial we assume that you are best aware of the following C programming topics:
- Operators in C Programming.
- Basic Input and Output function in C Programming.
- Basic C programming.
Program to Convert Inches to Centimeters
As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We cal perform many input-output operations using c programming. In today’s tutorial, we take the input in inches from the user and convert it into centimeters. With the help of c programming, we can perform many conversion operations.
With the help of this program, we can Convert Inches into Centimeters.
1. Declare the variables for the program.
2. Takeing the input number from the user for the program.
3. Passing that input for calculations.
4. Print the Result.
5. End the program.
Program to Convert Inches to Centimeters:-
/* Program to convert the inch input into the Centimeters output */
/*declaring the variables for the program */
float inch, cm;
/*taking the input from the user in inch*/
printf("Enter length in Inch: ");
/*scanning the input from the user*/
/*Coverting the inch into Centimeters.*/
cm = inch * 2.54;
Printing the result in Centimeters converted with the help of program
printf("Equivalent length in Centimeters = %0.2f", cm);
In the above program, we have first initialized the required variable.
- inch = it will hold the float value for the program as an input from the user.
- cm = it will hold the float value that will hold the grams converted in the program.
Taking the input from the user in the form of inch.
Printing the converted output from kilograms to grams.