Advertisement
We've partnered up with Nixers.com to offer a space where you can talk directly to Peter from Nixers.com and get an exclusive Boards.ie discount code for a free job listing. If you are recruiting or know anyone else who is please check out the forum here.
If you have a new account but can't post, please email Niamh on [email protected] for help to verify your email address. Thanks :)

# Temp conversion with c useing dev++

• 30-09-2016 9:55pm
Registered Users Posts: 35 ✭✭✭

Hi,

I am learning c, new to programing, any help with following would be much appreciated. Keeps giving me the answer 0.000000000:mad::mad::mad:

*****************************************************
#include <stdio.h>

int main()

{

//declarations
float celsius=0;
float fahrenheit=0;

printf("please enter a tempture in fahrenhiet \n");
printf("-->number must be from -500 to 1000 \n\n");
printf("****range is from -500 to 1000****\n");
scanf("%f", &fahrenheit);

if((fahrenheit<-500)||(fahrenheit>1000))
printf("invlid number range\n\a");

else {
celsius = faherheit -32 (5.0/9.0) *5 ;
printf("\nThe answer in celcius is ---->> %f", &celsius);
}
return 0;
}
*****************************************************
Tagged:

## Comments

• Registered Users Posts: 2,423 ✭✭✭

4 errors in this line
celsius = faherheit -32 (5.0/9.0) *5 ;

1 spelling error, and 3 errors in the conversion formula.

If fahrenheit is 212 then celsius should be 100.

Really important for a starter programmer to learn how to use the debug, breakpoint, step and inspect variable.

Loads of videos on youtube using dev c++. This one is less than 3 minutes.
https://www.youtube.com/watch?v=Jq1WTkOlk3w

• Registered Users Posts: 35 ✭✭✭

Thank's

Advertisement