GATE CS 2019 (Forenoon) — Question 62

Programming in CData Types, Syntax, Control Structures, LoopsNAT2 marksMedium

Consider the following C program:
c
1#include <stdio.h>
2int main ( ) {
3    float sum = 0.0, j = 1.0, i = 2.0;
4    while (i / j > 0.0625) {
5        j = j + j;
6        sum = sum + i / j;
7        printf("%f\n", sum);
8    }
9    return 0;
10}
11
The number of times the variable sum will be printed, when the above program is executed, is ________.
Practise the full 2019-FN paper
Challenge a friend: WhatsApp Telegram
Recommended book · affiliate linkCompilers: Principles, Techniques & ToolsThe "Dragon Book" for parsing, syntax-directed translation and code generation.
Practise more on Data Types, Syntax, Control Structures, LoopsTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group