I want to make a loop that will keep asking for an input until 0 is entered into the input. How would I go about doing this

Recommended Answers

All 4 Replies

You probably want a 'do while' loop here. The condition of the loop should be if the input is not 0. The content of the loop should be to get the input and get it into a form that it can be compared with 0.

Give it a shot and we'll help you if you get stuck.

Dave

here is some psuedo code:

declare var;
start Do Loop
  get input into var  
  if var is not equal to 0 then do stuff
  else just break out of the lop
end Do Loop if var equals 0;

well u can use a check variable and initially assign = 1
then inside the iteration keep asking to the input
if the input == 0
check = 0
close the iteration

#include<stdio.h>
voidmain()
{

commented: What is this? -1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.