What is the output of the following code snippet?
#include<stdio.h> int main ( ) { int x = 2, y = 5; if (x < y) return (x = x+y); else printf (“ GO Mock 1 ”); printf(“ Welcome to GO Mock test ”); }
@Bikram sir, I feel "Welcome to GO Mock Test" must be printed since in the else statement there are no curly braces which implies that only the first statement preceding the else is a part of else and rest aren't considered as a part of else.So as per this logic the second line should be printed by default.
64.3k questions
77.9k answers
244k comments
80.0k users