Convert Km to Meter, Centimeter or Millimeter

Convert Km to Meter, Centimeter or Millimeter

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn C programming concepts. You can learn C language at your own speed and time. One can learn concepts of C language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Convert Km to Meter, Centimeter or Millimeter
Convert Km to Meter, Centimeter or Millimeter

PROGRAM:Convert Km to Meter, Centimeter or Millimeter

/*    Convert Km to Meter, Centimeter or Millimeter    */
#include<stdio.h>
int main()
{
 float km;
 char v;
 float ans;

 printf(“K.M. : “);
 scanf(“%f”,&km);
 printf(“KM will be changed in (M,s,m) : “);
 fflush(stdin);
 scanf(“%c”,&v);
 if(v==’M’)
  ans=km*1000;
 if(v==’s’)
  ans=km*100000;
 if(v==’m’)
  ans=km*1000000;
 printf(“Answer : %.2f”,ans);
 return 0;
}

Leave a Reply

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