QUESTION 1 (a) Any statement may be placed.within an if statement, including other if statements. When you want to check multiple conditions there may be a need to put one if by a user is between two numbers. This could be written using two if statements the outer if statement checking to see if the value entered is greater than some minimum, and the inner if statement checking to see if the value entered is less than some maximum. Let's consider the following possibility: suppose you are asked to write a program that finds the maximum of three integers. This can be accomplished by writing nested if statements. The figure below depicts the flow of control for such a program

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
QUESTION 1
(a)
statements. When you want to check multiple conditions there may be a need to put
one if by a user is between two numbers. This could be written using two if
statements the outer if statement checking to see if the value entered is greater than
some minimum, and the inner if statement checking to see if the value entered is less
than some maximum. Let's consider the following possibility: suppose you are asked
to write a program that finds the maximum of three integers. This can be
accomplished by writing nested if statements. The figure below depicts the flow of
control for such a program
Any statement may be placed.within an if statement, including other if
Get input of integers
X, y and z
True
y > x
False
z>y
z>x
False
True
False
True
Print (z)
Print (y)
Print (z)
Print (x)
Print (Done)
Write a complete program to find the max of three integers. A program should
determine which of the three integers, x, y and z, was the greatest by first comparing
two of them, say x and y. Then depending on the outcome of that condition, compare
two more integers using nesting if statements to determine which is greatest.
2 | Bachelor of Engineering
(b) Write a program whepe we want the user to enter two floats and then choose of
options: tadd the two numbers, subtract the Two numbers multiply ine two numbers.
divido the Two numbers or exit e program The code should allow the user to choose
from a list of the above alternatives, In this case, consider a menu driven program.
You need to print a list of choices and have a user pick from that list. In such a
situation you may ant to use if statement and then nest an if statement inside of the
else clause.
(c) Create a program that reads two integers, a and b, from the user. Your program
should compute display.
The sum of a and b
The difference when b is subtracted from a
The product of a and b
The quotient when a is divided by b
The remainder when a is divided by b
The result of log1na.
• The result of a.
Transcribed Image Text:QUESTION 1 (a) statements. When you want to check multiple conditions there may be a need to put one if by a user is between two numbers. This could be written using two if statements the outer if statement checking to see if the value entered is greater than some minimum, and the inner if statement checking to see if the value entered is less than some maximum. Let's consider the following possibility: suppose you are asked to write a program that finds the maximum of three integers. This can be accomplished by writing nested if statements. The figure below depicts the flow of control for such a program Any statement may be placed.within an if statement, including other if Get input of integers X, y and z True y > x False z>y z>x False True False True Print (z) Print (y) Print (z) Print (x) Print (Done) Write a complete program to find the max of three integers. A program should determine which of the three integers, x, y and z, was the greatest by first comparing two of them, say x and y. Then depending on the outcome of that condition, compare two more integers using nesting if statements to determine which is greatest. 2 | Bachelor of Engineering (b) Write a program whepe we want the user to enter two floats and then choose of options: tadd the two numbers, subtract the Two numbers multiply ine two numbers. divido the Two numbers or exit e program The code should allow the user to choose from a list of the above alternatives, In this case, consider a menu driven program. You need to print a list of choices and have a user pick from that list. In such a situation you may ant to use if statement and then nest an if statement inside of the else clause. (c) Create a program that reads two integers, a and b, from the user. Your program should compute display. The sum of a and b The difference when b is subtracted from a The product of a and b The quotient when a is divided by b The remainder when a is divided by b The result of log1na. • The result of a.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY