0
This code compiles but show wrong value.why?
#include <iostream> using namespace std; int main() { int x,j,i; cin >> x; cin>>j; for (i=0;i<=j;i++) { x*=2; } cout<<"power is "<<x<<endl; return 0; }
5 Answers
+ 2
Maybe make a new cin>>i;
+ 2
The problem is at i <= j
it should be i < j
+ 1
what is solution ?
+ 1
You tell me đ
+ 1
if use sololearn editor
then
enter the first number and press enter and second number
and
for(i=1;i<=j,i++)