GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2026 set1

GATE 2026 set1 · CS · NAT · 1 mark · Programming and Data Structures › C Programming Fundamentals

GATE 2026 set1 Computer Science and Information Technology question: Consider the following program in C: code The output of the program is . (answer in…

Consider the following program in C:

#include <stdio.h>
void func(int i, int j) {
  if(i < j) {
    int i = 0;
    while (i < 10) {
      j += 2;
      i++;
    }
  }
  printf("%d", i);
}
int main() {
  int i = 9, j = 10;
  func(i, j);
  return 0;
}

The output of the program is _________. (answer in integer)

Note: Assume that the program compiles and runs successfully.

Show answer

Official answer: 9

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion