"The best way to cheer yourself up is to try to cheer somebody else up." Mark Twain

Tuesday, April 27, 2010

WAP to convert given inches into its equivalent yards , feet, inches. (1 yard = 36 inches, 1 foot = 12 inches)

#include<iostream.h>
#include<conio.h>

void main()
{
int in, yrd, ft, r;


cout<< " Enter distance/length in inches ";
cin>> in;


yrd = in/ 36; // calculate yard
r = in % 36; // remaining inches 
ft = r / 12; // calculate feet
r = r % 12; // remaining inches


cout<< " \n The distance in inches is " << in ;
cout << " \n The equivalent yard-feet-inches = " << yrd << " yard" << ft << "feet" << r << "inches" ;
getch();
}

No comments:

Post a Comment

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
Now Playing: Ballade Pour Adeline

About Me

My photo
I m an IT lecturer of a college. I love social-work. I want to do something beneficial for society before dying , that can promote our society, to some extent.