+ 3
Basic Arithmetic
can anyone please help me with a better trick to solve arithmetic codes... please help.. please
5 Réponses
+ 1
Do you have any examples
+ 1
int x = 5
int p = 1
while(p <__) {
cout<<__ x << endl;
p++;
}
what's the answer please...
and I'd appreciate an explanation
thanks in advance
+ 1
thank you...
the above was a fill in question in the challenge section...
I think I clue now..
thanks once again
+ 1
int x = 1;
while (x <= 5) {
cout << "value is " << x << endl;
x = x + 1;
}
Guys this is the answer, I am a 10 years old boy and think and try then got the correct answer.
- 1
while ( p< _ )
Well what exactly does p need to be less than? How many times do you want it to run? I assume the "answer" is x ( or 5 )
So while p (1) is less than x ( 5 ) this code is going to:
cout<<_x<<endl;
p++;
This says that while p is less than x, print x's value to screen and increment p by one then start over. Im not sure what you need in the blank space before x, as what you want is pretty vague. But anyways, ignoring that. All youre doing is printing x's value over and over again until p's value is no longer less than x's.
For what youre doing, youre better off using a for() statement.