0

hi! im also a beginner in using C im confused because ive got a problem. which the answer of C is different from mine here's my problem:
!our teacher ask us to covert yards to meters, inches, feet. (my problem is the meter)

feet = yard * 3
inches = yard * feet * 12
meter = yard * feet * inches * 2.54 / 100

lets say: 1 yard = 3 feet
1 yard = 36 inches
1 yard = 0.9144 meters <----------- (which is true!)

i don't understand C because the answer is 274.32 , derived form (1*3*12*2.54) /*in C*/
but in calculator the answer is 91.44 <----------- (which is true!)

please help me!

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by thunderwolf07
0

I'm newish aswell but try this

#include <stdio.h>

int main()
{	
	float input;

	printf("please enter how many Yards you wish to convert"\n");
	scanf("%f",&input);
	printf("%0.5f yards equals %0.5f inches, 0.5% feet and %0.5f meters",input,input*36,input*3,input*0.9144);
	system("pause");
}

it should convert it with 5 decimal places of accuracy

Edited by berwick53: n/a

0

thanks :D to your formula now i got the exact answer and the program :D i love this forum :D

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.