Turn Desktop View Off
You are here:   HomeC Programming (Theory)Basic Of C Prog.Write a C program to convert inches to yards, feet, and inches.
by Dinesh Thakur Category: Basic Of C Programming



#include <stdio.h>

void main()
int inches = 0;
int yards = 0;
int feet = 0;
const int inches_per_foot = 12;
const int feet_per_yard = 3;
printf("Enter a distance in inches: It);
scanf("%d", &inches);
feet = inches/ inches_per_foot;
yards = feet/ feet_per_yard;
feet %= feet_per_yard;
inches %= inches_per_foot;
printf("That is equivalent to %d yards %d feet and %d inches.\n",yards, feet, inches);
Enter a distance in inches: 124
That is equivalent to 3 yards 1 feet and 4 inches

Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.

What's New and Popular

Popular Article