Back to Browse

Gate 2005 pyq C programming | Consider the following C-program: void foo(int n, int sum)

276 views
Sep 24, 2022
19:51

Consider the following C-program: void foo(int n, int sum) { int k = 0, j = 0; if (n == 0) return; k = n % 10; j = n / 10; sum = sum + k; foo (j, sum); printf ("%d,", k); } int main () { int a = 2048, sum = 0; foo (a, sum); printf ("%d\n", sum); } What does the above program print? (A) 8, 4, 0, 2, 14 (B) 8, 4, 0, 2, 0 (C) 2, 0, 4, 8, 14 (D) 2, 0, 4, 8, 0

Download

1 formats

Video Formats

360pmp457.7 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Gate 2005 pyq C programming | Consider the following C-program: void foo(int n, int sum) | NatokHD