GATE CS 2025, set 1 · Question 63 · Programming and Data Structures · Numerical answer (NAT) · 2 marks · no negative marks

Consider the following C program:
#include <stdio.h> int gate (int n) { int d, t, newnum, turn; newnum = turn = 0; t=1; while (n>=t) t *= 10; t /=10; while (t>0) { d = n/t; n = n%t; t /= 10; if (turn) newnum = 10*newnum + d; turn = (turn + 1) %2; } return newnum; } int main () { printf ("%d", gate(14362)); return 0; }
The value printed by the given C program is ______ . (Answer in integer)

Answer

Answer 46

Answer from the official GATE CS 2025 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes