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

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

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

Ans.

#include<stdio.h>  //for standard input and output

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

 

//Main Function

void main()

{

float inches,feet,yard;

clrscr();  //for clear screen

 

printf(“\n Given input in inches: “);

scanf(“%f”,&inches);

 

feet=inches/12;

yard=feet/36;

 

printf(“\n Output in yards: %f yards”,yard);

printf(“\n Output in feet: %f feet”,feet);

printf(“\n Output in inches: %f 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 *

1020 Views
%d bloggers like this: