km in meters,feet,inches and centimeters - C program

language:  this is a C program
software used : code blocks
short name : km in meters,feet,inches and centimeters.

topic:
The distance between two cities (in km) is input through the keyboard. Write a program to convert and print the distance in meters,feet,inches and centimeters.


solution :


#include <stdio.h>


int main() {
    int dist,m,cm,in;
    float ft;
    printf("Enter the distance between two cities(in km)= ");
    scanf("%d",&dist);
    printf("\nWait ....the conversion is taking place \n ");

    // formula : km to m

    m=dist*1000;
    printf("\n in meters = %d m",m);

    // formula : km to feet

    ft=dist*3280.84;
    printf("\n in feet = %.2f ft",ft);
    // formula : km to inches

    in=dist*39370;
    printf("\n in inch = %d in",in);
    // formula : km to cm

    cm=dist*100000;
    printf("\n in centimeter = %d cm",cm);

    printf("\n");
    return 0;
}




 the output :

 








N:B -   you can also use #include<conio.h>, clrscr( ); and getch( ); if you use 'turbo c'  or some old software.As i used codeblocks it was not needed.

Comments

  1. How to Play Slots With $10 No Deposit Bonus - Dr
    In 남원 출장마사지 addition, the 익산 출장안마 bonus does not require a deposit of at least $10 or more on 울산광역 출장마사지 the site. This 아산 출장마사지 is a bonus that is 사천 출장안마 designed to keep you entertained while you

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Thanks for sharing this worth reading article. This is really helpful. Keep sharing. 1.5 cm to inches

    ReplyDelete

Post a Comment

Popular posts from this blog

library fine - c program

Marks given(5 subjects) : find percentage and aggregate