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