Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int sum = 0;
- int mas[100];
- void massive (int i)
- {
- scanf("%d", &mas[i]);
- if (mas[i] != 0)
- {
- massive(i+1);
- }
- }
- void suma (int i)
- {
- if (mas[i] != 0)
- {
- sum += mas[i];
- suma(i+1);
- }
- }
- int main()
- {
- massive(0);
- suma(0);
- printf("%d", sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement