Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int numero = 0;
- int numeroprecedente = 0;
- int numerotmp;
- int sum = 0;
- int main()
- {
- numero = 1;
- numeroprecedente = 0;
- numerotmp = numeroprecedente;
- while(1)
- {
- numerotmp = numero;
- numero += numeroprecedente;
- numeroprecedente = numerotmp;
- sum += numero;
- if(numero>40000000) break;
- printf("%i\t",numero);
- }
- printf("\nSum: %i\n",sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement