I got this coding question during my java interview. Count down from 100 to 0...

I got this coding question during my java interview. Count down from 100 to 0. you cannot add any code at the beginning and can only write code within the for loop.
for ( int i = 0; [code/]

Attached: brainlettttt.jpg (800x450, 41K)

I don't remember java but something like
i

is this bait? this code doesn't make any sense if you are counting down from 100 to 0, the for loop starts at 0, the loop fulfills the objective before it even begins processing.

for (i = 100; i >= 0; i--)

that's a stupid question, are those guys retards?

This

pajeets

The question is designed to filter out retards like you.

Congrats, you failed

Attached: 1534737818694.gif (404x561, 166K)

for(int i = 0; i

based

cringe

for(int i = 0; i >= -100; i--){
const auto counter{100 + i};
std::cout

nice bait

for(int i = 0; i < 1; i++) printf("100\n99\n...0\n");

Impossible as specified. Printing numbers in 100..0 is trivial but that isn't counting down.

Still trying huh?

for(int i=0;i

How is it not? You're counting down from 100 there

So are interview questions just to quickly test if you're a liar?

Can't declare variables in for loops under c89, refuse to answer the question unless you know what compiler you're working with

for (int i = 0; i < 100; printf("%d\n", i++))

This is the way.
All of you are wrong.
Note that this isnt 100 to 0 but 0 to 100 (not including 100 obviously).

read nigger read

based

negroid it says java, and 'within for loop' probably doesn't mean withing the () but within a for loop block, considering this is an interview question

Oh right its counting from 100 to 0 specifically.
for (int i = 0; i < 100; printf("%d\n", 100-(i++)));

Printing isnt needed technically but whatevs.

Does this print 0?

disgusting

Of course it does you brainlet

>ended it with a semicolon
Wow, someone actually got it right. Be sure to point out that you did this, "a for loop except a semicolon was placed at the end" is a classic find-the-bug interview question

Does this print 100?

I just ran it, and it went from 100 to 1. But you can already see from the code it would do that

So use

I know. I'm pointing out the mistake

for ( int i = 0;;) {
for(i=100; i