Urgent Help again!

sarrocks
6 years ago

-2

Hello Guys. Please give me output and logic of this program
int a;
a=0;
while (1)
{ for (a=0;a<6;a++)
if(a%2==0)
break;
if(a>0)
break;
}
printf(“%d”,a);
P.S.- I have not omitted any braces inside while loop. Please give me logic of this program and its output.
Thank you

7replies
7voices
224views
dloser
6 years ago

4

Yeah… perhaps not. It seems you are trying to use us as some kind of homework-making device.

If you have a concrete question about something specific, I’m sure we are willing to help. But please don’t abuse this willingness with these kinds of requests. It’s not really respectful and most likely not what is expected of you by whomever gave you these exercises.

Smyler [WHGhost]
6 years ago

3

Why don’t you ask your computer?
Or your brain?
The two are quite different but both work.
A sheet of paper might be useful too if you want to use the second (but isn’t really need for something that simple).

If you want to progress in hacking and programming, you need to always consider this kind of exercise as a challenge, if your mindset is to ask for such simple things, you should just quit all of this, you will never go anywhere.

sarrocks
6 years ago | edited 6 years ago

0

Due to technical faults , I dont currently have a laptop , so I have been told to google all these questions and search for the logic or anything which I dont get , so I am not doing anything illegal. I work at a robotic facility where we program robots for competitions , and I am a junior there so I have been told to only observe what they do and search about what I dont understand.
P.S.- What I ask is only about 5% of the whole code which I am not clear about. The actual code includes line-tracer and rotary encoder algorithms too.

Z3R074
6 years ago

0

Try reading through this tutorial then figure it out yourself. I have read your other posts and all I can say is if you want to be spoon fed answers then you are clearly on the wrong site. https://www.codingunit.com/c-tutorial-for-loop-while-loop-break-and-continue

dloser
6 years ago

2

Nobody said anything about illegal, @sarrocks**. But I guess you just had to make it worse with your bullshit story that makes no sense whatsoever. Seems to me you have bigger problems than not understanding simple pieces of code.

Darwin [DIDIx13]
6 years ago

0

dloser is fully right.

You aren’t talking to the good person if you need slaves or idiots.


1

Agreed. As harsh as it is, it’s totally justified. The people here have given you good links and relevent information to help you learn and you’re still trying to take advantage of them.

If you’re interested in learning C or don’t understand something and want to know, a quick google search will get you far. All you need is internet access, not even a computer or laptop. Just stop trying to get spoon fed and you might actually learn something.

Reply has been removed
You must be logged in to reply to this discussion. Login
1 of 8

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss