dont know if anybody knows or remembers C, but i need someone to check if my coding needs clean up or what.
here's the problem (by the way, we just did our section on the 'while' statement so ya):
here's my coding:
any help would be appreciated , i might have more coding to post too if anybody knows Java or C. otherwise, THANKS FOR NOTHING ASSHOLES :S[wow][/wow]
here's the problem (by the way, we just did our section on the 'while' statement so ya):
Write a C program to convert Celsius degrees to Fahrenheit. The program should request the starting Celsius value, the number of conversions to be made, and the increment between Celsius values. The display should have appropriate headings and list the Celsius value and the corresponding Fahrenheit value. Use the relationship: Fahrenheit = (9.0/5.0) * Celsius + 32.0
here's my coding:
#include stdio.h <------- left the brackets out on purpose, wouldn't show that part
int main()
{
// initialize variables
int maxcount, counter = 1;
float celsius, fahrenheit, increment;
// prompt user for starting celsius
printf( "Please enter the starting celsius value: " );
scanf( "%f", &celsius );
// prompt user or increasing value
printf( "Please enter the maximum amount to convert to fahrenheit: " );
scanf( "%d", &maxcount );
// prompt user for increasing value
printf( "Please enter amount to increase celsius: " );
scanf( "%f", &increment );
// blank line
printf( "\n" );
// Heading of Table
printf( "CELSIUS FAHRENHEIT\n" );
printf( "------ ----------\n" );
// while loop
while( counter <= maxcount )
{
if( counter == 1 )
{
fahrenheit = ( 9.0 / 5.0 ) * celsius = 32.0;
printf( "%7.1f%13.1f\n", celsius, fahrenheit );
counter++;
}
else
{
celsius += increment;
fahrenheit = ( 9.0 / 5.0 ) * celsius = 32.0;
printf( "%7.1f%13.1f\n", celsius, fahrenheit );
counter++;
}
}
return 0;
}
any help would be appreciated , i might have more coding to post too if anybody knows Java or C. otherwise, THANKS FOR NOTHING ASSHOLES :S[wow][/wow]