C++ program to convert inches into yards, feet and inches.

Q25. Write a program to convert given inches into its equivalent yards, feet and inches.

(1 yard = 36 inches, 1 foot = 12 inches)

Ans.

#include<iostream.h>

#include<conio.h>  //for clrscr()

 

//Main Function

void main()

{

float inches,feet,yard;

clrscr();  //for clear screen

 

cout<<“\n Given input in inches: “;

cin>>inches;

 

feet=inches/12;

yard=feet/36;

 

cout<<“\n Output in yards: “<<yard<<” yards”;

cout<<“\n Output in feet: “<<feet<<” feet”;

cout<<“\n Output in inches: “<<inches<<” inches”;

 

getch();  //To hold the output screen

}

//End of main()

 

Output:

Given input in inches: 3600

 

Output in yards: 8.333333 yards

Output in feet: 300 feet

Output in inches: 3600 inches

Leave a Reply

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

2 Views
%d bloggers like this: