Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- main (){
- int i;
- float soma = 0.0;
- float divisor, termo;
- float numerador = 1000;
- for (i=1; i<=20; i++){
- printf ("\nNumerador = %5.2f.\nDivisor = %d\n", numerador, i);
- termo = numerador/i;
- if (i %2 == 0)
- soma = soma - termo;
- else soma = soma + termo;
- numerador = numerador - 3;
- }
- printf ("\nSoma = %5.2f", soma);
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement