Unit 2 guided practice 1: use an “if” statement to decide if an age | introduction to programming | ECPI University

 

The following program uses a decision structure to decide if a user-entered value is reasonable.  We ask the user for an age, and, if the age is less than 10, we tell the user the age isn’t valid, and give the user another chance to enter a value greater than 10.  If the age is 10 or greater, we tell the user the age is valid.  In any case, after the second attempt, the user receives the message that they’ve entered a valid age.

Here’s the Flowchart:

And here is the code:

And here is the output:

Now, re-create the flowchart in Flowgorithm and run the code in your Dev C++ compiler.

Upload your flowgorithm file, .c file, and a screen shot of your code output saved in a Word document including the path name directory at the top of the screen into the dropbox for grading.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>