File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change 2
2
3
3
/* affiche une table de conversion des degrés en Fahrenheit-Celsius*/
4
4
5
+ #define LOWER 0 /*limite basse de la table*/
6
+ #define UPPER 300 /*limite haute de la table*/
7
+ #define STEP 20 /* taille du pas*/
8
+
5
9
int main ()
6
10
{
7
11
// Déclaration (placé avant toute instruction)
8
12
float fahrenheit ;
9
13
float celsius ;
10
- int lower ;
11
- int upper ;
12
- int step ;
13
-
14
- // Assignement
15
- lower = 0 ;
16
- upper = 300 ;
17
- step = 20 ;
18
14
19
- fahrenheit = lower ;
15
+ fahrenheit = LOWER ;
20
16
21
17
// Header, aligné avec le tableau.
22
- printf ("%12s\t%12s\n" ,"Fahrenheit" , "Celsius" );
18
+ printf ("%12s\t%12s\n" , "Fahrenheit" , "Celsius" );
23
19
24
- while (fahrenheit <= upper )
20
+ while (fahrenheit <= UPPER )
25
21
{
26
- celsius = (5.0 / 9.0 ) * (fahrenheit - 32 );
22
+ celsius = (5.0 / 9.0 ) * (fahrenheit - 32 );
27
23
printf ("%12.0f\t%12.2f\n" , fahrenheit , celsius );
28
- fahrenheit = fahrenheit + step ;
24
+ fahrenheit = fahrenheit + STEP ;
29
25
}
30
26
}
You can’t perform that action at this time.
0 commit comments