Take a positive integer from the user. Keep displaying anerror message and prompting for input again
and again if the user enters invalid input (negative or zero)
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted May 8, 2012, 12:37 PM EDT
SenthilkumarRank #387 · 6.5K reputationPosted May 8, 2012, 7:32 PM EDT
for(;;)
{
}
or
while(true)
{
}
or
do
{
}
while()
when you meet your criteria to get the positive integer then you can exit from the loop.