473,320 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
1 1871
Frinavale
9,735 Expert Mod 8TB
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

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

Similar topics

5
by: scorpion53061 | last post by:
Is there a way that anyone knows to force a vb.net program to shut down and then restart itself?
1
by: Anh Khuong | last post by:
Hi all, In some cases I click button to open dialog using ShowDialog(this) method, it make program freeze. Can you show me which cases this method cause problem above? Here are stack dump...
7
by: wuzertheloser | last post by:
A mathematical relationship between x and y is described by the following expressions: y= A*x^3-B*x+3/4 if x<=0 (Case 1) y=1-B-C*x^4 if 0<x<1 (Case 2) y=A*log10(x)+B/x ...
12
by: elty123 | last post by:
I have a small C# program (about 400 lines of code) that is only 28kb after compiled. However when it runs (takes a whole 5 seconds) it takes up nearly 20MB of memory and I don't see why. ...
1
by: Santek Moreli | last post by:
I am creating a simple program using a couple methods that will ask the user to input data (type int) until an empty string is entered, after which the output will be displayed. I need to figure...
5
by: sunithasiraj | last post by:
int a,i,l,s,n; l=0,s=0; printf("Enter the limit\n"); scanf("%d",&n); printf("Enter the array\n"); for(i=0;i<n;i++) scanf("%d",&a); for(i=0;i<n;i++) if(a>l) {
2
by: Bisyar khub | last post by:
hello,...i want to make program to square the numbers from 1 to 20. i have written this program, it's running but not giving the required answer.i think it is giving a garbage value...please tell me...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.