New course! Every coder should learn Generative AI!
Try a free lesson0
Can someone help me make this work pls??. Thanks!
I would need an answer for all 3 integers.
9 Answers
+ 7
Can you post your code that you're having trouble with? Thanks!
+ 7
I hate to say this, but I really don't know. 2686816 shouldn't be the correct answer...
This is a really interesting code! Post another question. Say that the first person to explain what is happening will get all their codes upvoted by you.
+ 6
@Dan, you never declared a value for int c. Is that your problem?
Or, is your problem getting it to print?
+ 6
Well let's see...
To start with int i and int x were never defined.
if you write c++ instead of i++, you get 2686816 as the value of int c.
I could probably help more if you tell me what you're trying to accomplish. Are you making an actual program, or are you just testing things?
0
#include <iostream>
using namespace std;
int main()
{
int a = 0;
int b = 0;
int c;
while(a<3){
b = b+5;
a++;}
return 0;
}
0
lol of course
0
@caleb. well that was the question. to find the proper answer for a,b,c. and when I write cout for all of them I get some type of answer. I just want to know if someone knows a different way to get an answer . this is how I tried to solve it.
#include <iostream>
using namespace std;
int main()
{
int a = 0;
int b = 0;
int c;
while(i<3){
x = x+5;
i++;}
cout << a << endl;
cout << b << endl;
cout << c << endl;
return 0;
}
0
I'm just testing things. I had originally write them with i and x and i forgot to change them to abc . 2686816 is also what I get. so, that result would be correct? (I corrected the code)
0
thanks will do!