Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
int n = 15;
for ( ; ;)
cout << n;
return 0;
}

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
int n = 15;
for ( ; 😉
cout << n;
return 0;
}
a) error
b) 15
c) infinite times of printing n
d) none of the mentioned

Answer: c
Explanation: There is not a condition in the for loop, So it will loop continuously.

Join The Discussion