edited by
494 views
0 votes
0 votes
int func(int a)
{
    if(a<=0)
    return a;
      else
       {
        printf(a);
        func(a-2);
        printf(a);
        func(a-3);
        }
 }
#include<stdio.h>
int main(void)
     {
        int a=6;
        func(a);
     }

what will be the sum of all values that printed ?

edited by

1 Answer

Best answer
1 votes
1 votes

Values printed : 6 4 2 2 4 1 1 6 3 1 1 3

Sum : 34

selected by

Related questions

0 votes
0 votes
1 answer
1
SSR17 asked Feb 29
205 views
#include <stdio.h int main() { int i = -1; int x = (unsigned char)i; printf("%d", x); return 0; }output is 255 , but please explain how
2 votes
2 votes
1 answer
4
rupamsardar asked Aug 30, 2023
468 views
#include <stdio.h int f(int x) { if(x%2==0) { return f(f(x-1)); } else return (x++); } int main() { printf("%d",f(12)); ret...