Originally Posted by
jcard71
I just want to star by saying I'm not looking for any answers to my assignments, but just some help as to where to go next...
Hi,
I just started an Intro to C class 2 weeks ago and so far so good, but as a newbie
to programming, it's is a little overwhelming at times. I was able to complete my first assignment without a problem, but my second one has me stumped...
I need to write a program that converts 27 from degrees Fahrenheit (F) to degrees Celsius (c) using the formula below...
C = (F - 32) /1.8
I was hoping someone could point me in the right direction or show me an example using the formula above. Below is a program I wrote and wondering how I can add the formula to this?
well, u can always serach the borad as what DWKs says. but here some of the tips that u can start with. u reqire some of these fucntion in order to go ahead with the soultion to the problem. u need scanf, printf. i dont know wheather u knnow how to use these fucntion. but here is syntax for those
Code:
printf("format specifier£, variables name);
eg: printf("The Celsius %d", C);
scanf("format specifier", address of the variables);
eg: scanf("%d",&C);
given any formula, it s easy to convert to a code. lets take a very simple example, for instance if u take a expression something like this (a + b) * (b * b + 2b), how do u go ahead to convert this into a C code
the answer is just the same the only change is that u need to store the result in some place so that u can retain it back where ever u need it. the solution could look soemthing like this
Code:
result = (a + b) * (b * b + 2b);
NOTE: result is just a varibale
so u have rought ideia of how to covert a expression to a code. having this expression now C = (F - 32) /1.8 . how do u convert this expression. very simple its all the same but need to ready the value for the varibale F for u can literally insert it in the expression. here is a pesudo code for the problem.
Code:
declare a variable C
read the value for F
C = ( F * 32) / 1.8
output the C
ssharish2005