Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple temp conversion program

Status
Not open for further replies.

borman

Programmer
Sep 14, 1999
3
CA
Hello...I am just starting out in C and was wondering what would be the best formula to enter into a fahr to celsius mainline?<br>
<br>
<br>
#include&lt;stdio.h&gt;<br>
<br>
#define ?????<br>
<br>
int main()<br>
<br>
{<br>
<br>
printf(??);<br>
scanf(.....);<br>
<br>
return(0)<br>
}<br>
/*your help would be much appreciated*/<br>
/*thanks*/<br>
<br>

 
If i understand your question you just want to a fareniheit to calsius convert. If i remember that can be done with say<br>
<br>
int x, y;<br>
<br>
printf(
 
Hi i was wondering if their was anyway to remove the null at the end of a sting for print out. I talked with my professor for a while about this and he coudn't think of a way to do it. The print out is using fwrite, i know how to do it using fprintf.<br>
<br>
thanks <br>
tom moses
 
#include &lt;stdio.h&gt;<br>
<br>
void main()<br>
<br>
{<br>
float Celsius = 0;<br>
<br>
float Fahrenheit = 0;<br>
<br>
printf(&quot;Please enter the Fahrenheit temperature: &quot;);<br>
<br>
scanf(&quot;%f&quot;, &Fahrenheit);<br>
<br>
Celsius = ((Fahrenheit - 32)5)/9;<br>
<br>
printf(&quot;\nThe temperature is %7.2f degrees Celsius\n\n&quot;, Celsius);<br>
}
 
Thanks code head...I tried the declarations and the other statements, then I modified the code a bit....<br>
<br>
#include&lt;stdio.h&gt;<br>
<br>
int main ()<br>
<br>
{<br>
double fahr;<br>
double celsuis;<br>
double fahrenheit; <br>
<br>
printf(&quot;Enter Farhenheit value: \n\n&quot;);<br>
scanf(&quot;%lf&quot;, &fahr);<br>
<br>
<br>
printf(&quot;Centigrade value: %.2lf\n&quot;, (fahr-32) * (5.0/9.0)); <br>
<br>
<br>
return (0);<br>
<br>
}<br>
<br>
<br>
<br>

 
C/5 = (F-32)/9.<br>
<br>
Assign to a float value<br>
Does it answer your question ?<br>
Thanx,<br>
Siddhartha Singh<br>
<A HREF="mailto:ssingh@aztecsoft.com">ssingh@aztecsoft.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top