By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,584 Members | 3,458 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,584 IT Pros & Developers. It's quick & easy.

How to make a c program which takes input until it is greater than 18

P: 1
i want to make c program which takes the input..until it is greater than 18 when it becomes greater than 18 then print adult.
Dec 4 '17 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 9,731
What have you tried so far to solve the problem?

It seems like a pretty straightforward thing to do:
  1. Ask the user for their input
  2. Get the user's input
  3. Check if the user's input is a number: if not, display a message stating their input must be a number and go back to step 1
  4. Check if the number is greater than 18: if not return to step 1; otherwise display your message.

This can be accomplished with loops and if statements.

Have you ever tried using a While Loop?

Are you having problems with understanding how to loop or how to stop looping?

Are you having problems understanding how to get input?

Are you having problems understating how to print output to the screen?

Are you having problems determining what the value was that the user entered?

What are you having problems with?
Dec 5 '17 #2

Post your reply

Sign in to post your reply or Sign up for a free account.