Wednesday, September 5, 2012

Convert Meters into Kilometers

Write a C program to convert meters into kilometers. 


#include<stdio.h>
#include<conio.h>
void main()
{
int km,m;
clrscr();
printf("Enter the miter ==>");
scanf("%d",&m);


km=m/1000;

printf("km=%d",km);
getch();

}

--------------------------------------------------------------------------------
Write a C program to convert kilometers to meters

#include<stdio.h>
#include<conio.h>
void main()
{
        int meters,kilometrs;
        clrscr();
printf("\n\nEnter the kilometers =>");
scanf("%d",&kilometrs);
        meters=kilometrs*1000;
        printf("\nmeters=%d",meters);
getch();

}

3 comments:

  1. Would you like to help me to convert kilometers into meters and meters into kilometers in a same program?
    For Example:
    The program ask to the user which operation do you want to perform either converting km to m or m to km.
    If you help me I shall be very thankful to you.
    Have a nice day
    Waiting for your code
    Muhammad Shumail Mushtaq Jutt

    ReplyDelete
  2. Plz give me the C code to convert hours in mili seconds?

    ReplyDelete