30 likes | 150 Vues
This C program generates a table converting Fahrenheit to Celsius in increments of 20, ranging from 0 to 300 degrees Fahrenheit. Using defined constants for the lower and upper limits as well as the step size, the program utilizes a for loop to calculate the Celsius equivalent of each Fahrenheit value according to the formula (5.0/9.0)*(fahr-32.0). The resulting table is printed clearly, demonstrating the relationship between the two temperature scales in a well-structured format.
E N D
Symbolic Constantsثابتهاي نمادين #define name replacement-text #define مقدار جايگزيني نام
#include <stdio.h> #include <conio.h> #define LOWER 0 /* lower limit of table */ #define UPPER 300 /* upper limit */ #define STEP 20 /* step size */ /* print Fahrenheit-Celsius table for fahr = 0 , 20 , … , 300 */ main() { int fahr ; clrscr() ; for ( fahr = LOWER ; fahr <= UPPER ; fahr = fahr + STEP ) printf( “%3d %6.1f\n” , fahr , ( 5.0 / 9.0 ) * ( fahr – 32.0 ) ) ; } Fahr_def.c initialization test or condition increment
GraphOfGrades Graph_Of_Grades graphofgrades