← Walmart questions

Print 1 to 20 using two threads alternately

Filed under Walmart

Write multi-threaded code to print numbers from 1 to 20 using two threads, where one thread prints only even numbers and the other prints only odd numbers alternately.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Walmart questions

Collected from public candidate posts and coding forums. Updated Nov 2026.