GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2025 set2

GATE 2025 set2 · CS · NAT · 2 marks · Programming and Data Structures › C Programming Fundamentals

GATE 2025 set2 Computer Science and Information Technology question: Consider the following C program: code The output of the given C program is . (Answer in…

Consider the following C program:

#include <stdio.h>

int g(int n) {
    return (n+10);
}

int f(int n) {
    return g(n*2);
}

int main() {
    int sum, n;
    sum=0;
    for (n=1; n<3; n++)
        sum += g(f(n));
    printf ("%d", sum);
    return 0;
}

The output of the given C program is ________. (Answer in integer)

Show answer

Official answer: 46

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion