GATE CS 2024, set 1 · Question 18 · Programming and Data Structures · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer
Consider the following C program:
#include <stdio.h> int main(){ int a = 6; int b = 0; while(a < 10) { a = a / 12 + 1; a += b;} printf("%d", a); return 0;}
Which one of the following statements is CORRECT ?
- (A) The program prints 9 as output
- (B) The program prints 10 as output
- (C) The program gets stuck in an infinite loop
- (D) The program prints 6 as output
Answer
Answer (C)
Answer from the official GATE CS 2024 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes