-
What is the output of this program?
#include
using namespace std;
int main()
{
int k;
for (k = 0; k < 20; k++);
{
cout << k;
}
return 0;
}
-
- 0
- 20
- Compilation Error
- Runtime Error
- None of these
Correct Option: B
for loop with a semicolon is called as body less for loop. It is used only for incrementing the variable values. So in this program the value is incremented and printed as 20.