C Program to Convert Centimeter to Meter and Kilometer

C Program to Convert Centimeter to Meter and Kilometer

C program to convert centimeters to meters and kilometers; Through this tutorial, we will learn how to convert centimeters to meters and kilometers in the c program.

Algorithm to Convert Centimeter to Meter and Kilometer

Use the following algorithm to write a c program to convert centimeters to meters and kilometers; as follows:

  • Start program.
  • Take input centimeter and store in it.
  • Convert centimeter to meters and kilometers by using this two formula
    • meter = cm / 100.0;
    • km = cm / 100000.0;
  • Print meter and kilometer.
  • Stop program.

C Program to Convert Centimeter to Meter and Kilometer

/* C Program to Convert Centimeter to Meter and Kilometer */
 
#include <stdio.h>
 
int main()
{
  	float cm, meter, km;
 
 	printf("\n Please Enter the Length in Centimeters  :  ");
  	scanf("%f", &cm);
  
  	meter = cm / 100.0;
  	km = cm / 100000.0; 	
 
    printf("\n Length in Meters  = %.4f", meter);
    printf("\n Length in Kilometers   = %.4f", km);
  
   	return 0;
}

The output of the above c program; as follows:

Please Enter the Length in Centimeters  :  1000
Length in Meters  = 10.0000
Length in Kilometers   = 0.0100

Recommended C Programs

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *