Curso de Programación en C/Prog135
								
								Ir a la navegación
				Ir a la búsqueda
				
					
								
							
		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]$