Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Line 20) I want the output of the program to say Invalid Input if the user enters a number less than 1 or greater than

image text in transcribed

(Line 20) I want the output of the program to say "Invalid Input" if the user enters a number less than 1 or greater than 100. My code works if I enter a number greater than 100, but not when I enter a number less than 1.

For example, when the user input is 305, it will successfully output "Invalid Input"

But when the user input is 0, it won't say anything

8 #include 9 int main() { 10 11 int userNum;//this is the number that the user will input (between 1 and 100) / 12 int incNum;//this is the number that will be increasing to userNum/ 13 printf("Welcome to FizzBuzz Enter a number between 1 and 100: n") scanf("%d", &userNum); 15 16 17 18 19 v 20 21 incNum -1; while (ncNum

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions