Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void) {
- int num, soma, fatorial;
- scanf("%d", &num);
- soma = 0;
- fatorial = 1;
- if (num > 0) {
- while (num > 0) {
- soma = soma + num;
- fatorial = fatorial * num;
- num = num - 1;
- }
- printf("soma: %d\n", soma);
- printf("fatorial: %d\n", fatorial);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement