![]() |
No items matching your keywords were found.
COMPUTER PROGRAMMING?
include
#include
//declare FtoC
void FtoC(int start, int end, int increment);
void main(void)
{
//declare
intstart1, end1, increment1;
//input
printf("Enter the start, end and increment values: ");
scanf("%d %d %d", &start1, &end1, &increment1);
//call
FtoC(start1, end1, increment1);
} //exit main
//function defination
void FtoC ( int start, int end, int increment )
{
intCel;
floatFah;
printf("Fahrenheit Celsiusn");
printf("--------- -------n");
for (Fah = start; Fah <= end; Fah = Fah + increment)
{
//calculate and print
Cel = 5.0 * (Fah - 32)/9;
printf("%9.1d %8.2fn", Fah, Cel);
}//end for
} //end
Whats wrong with my program i can succeed in running it, but but i cannot get a proper answer. Pls Help.
Change:
intCel;
floatFah;
to:
intFah;
floatCel;
and change:
Cel = 5.0 * (Fah - 32)/9;
to:
Cel = 5.0 * ((float)Fah - 32.0) / 9.0;
and change:
printf("%9.1d %8.2fn", Fah, Cel);
to:
printf("%9d %8.2fn", Fah, Cel);
![]() |
No items matching your keywords were found.
