Curso de Programación en C/Prog135
< Curso de Programación en C
								Ir a la navegación
				Ir a la búsqueda
				Revisión del 11:24 23 nov 2012 de Rrc (discusión | contribuciones) (Página creada con '__NOTOC__ *  ifdef **  Resultado **  Explicación  == Prog135 ==  <syntaxhighlight lang="c" line="GESHI_FANCY_LINE_NUMBERS"> ...')
Prog135
 1 #include <stdio.h>
 2 
 3 #define A_VER
 4 #define LIMIT 4
 5 
 6 int main(void)
 7 {
 8   int i;
 9   int total = 0;
10 
11   for( i = 1; i <= LIMIT; i++ )
12   {
13     total += 2 * i * i + 1;
14 #ifdef A_VER
15     printf( "i = %d, SubTotal = %d\n", i, total);
16 #endif
17   }
18   printf( "Total = %d\n", total );
19 
20   return 0;
21 }
Resultado
[rrc@pwyr CClase]$ gcc -Wall -o Prog135 Prog135.c [rrc@pwyr CClase]$ ./Prog135 i = 1, SubTotal = 3 i = 2, SubTotal = 12 i = 3, SubTotal = 31 i = 4, SubTotal = 64 Total = 64 [rrc@pwyr CClase]$