Consider the code snippet given below:-
[Assume the necessary header files and namespaces included]
int x=10;
int main()
{ int x=20;
{ int x=30;
}
return 0;
}
Include the ‘cout’ statements at appropriate places in the program to get the output
10 20 30
#include<iostream>
using namespace std;
int x=10;
int main()
{
cout<<x<<" ";
int x=20;
cout<< x<<" ";
{ int x=30;
cout<<x;
}
return 0;
}
Comments
Leave a comment