Wednesday, July 24, 2013

Program to enter your height in centimeters and convert into feet and inches


#include<iostream.h>
#include<conio.h>
void main()
{
  clrscr();
  float ht,inch,feet;
  cout<<"Enter your height in centimeters : ";
  cin>>ht;
  feet=ht/30.48;  
  inch=ht/2.54;
  cout<<"Height in feets : "<<feet;
  cout<<"Height in inch : "<<inch;
  getch();
}

13 comments:

  1. thank u, athulsiri am a class 11 student and ur program helped me a lot :)

    ReplyDelete
  2. It was helpful but after certain number of repetitions it got 'mad' i mean at 156 cm it shows 5.2 feet and 0.376 inches??
    Then i inserted 182 and all it showed was 00?? It was great as well as disastrous

    ReplyDelete
    Replies
    1. Do it as an int. Int feet,outputinches, inches;

      input inches then

      feet=inches/12 // this is called integer division
      outputinches=inches%12 //% is the modulus operator.
      I hope this might help you. I have even got the same task in my school. I am also presently in class 11 and studying computer science

      Delete
    2. Can you please show the output of the program become it's showing wrong in my Dev c++ user if you can show the output then I think it will be very helpful for me

      Delete
  3. Nice one bro i hope it will work...let me try it
    Http://damytechs.com

    ReplyDelete
  4. Quickly convert centimetres into inches (cm to inches) using the online calculator for metric conversions and more.

    ReplyDelete
  5. Please show the output become it's coming wrong. If u can show the output of the program I think then it will be very helpful for me

    ReplyDelete