Problem #4
Var x;
While (x <=5) {
Print ();
x = x + 1;
}
What is the answer?
1. If x = 3
Answer =
2. If x = 1
Answer =
#include<iostream>
using namespace std;
int main()
{
int x;
cout<<"Enter the value of x: ";
cin>>x;
while (x <=5) {
cout<<x;
x = x + 1;
}
}
1 if x=3
Answer=345
2 if x=1
Answer=12345
Comments