Concept explainers
Exercises 43-50 refer to the following
Write Number2
Suppose we want to precede the last statement in this program by a statement that displays the following message:
The result of the computation is:
Write me such a statement.
Want to see the full answer?
Check out a sample textbook solutionChapter 1 Solutions
Prelude to Programming
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (6th Edition)
Problem Solving with C++ (9th Edition)
Database Concepts (7th Edition)
Starting Out with Java: Early Objects (6th Edition)
Experiencing MIS
Artificial Intelligence: A Modern Approach
- 21. Most algorithms follow the format of a. Entering the input items, then processing the input items, and then displaying the output items b. Entering the input items, then displaying the input items, and then processing the output items c. Entering the input items, then processing the output items, and then displaying the output items d. Entering the output items, then displaying the output items, and then processing the output itemsarrow_forwardRewrite the given program to follow these instructions: The program in the Programming Example: Fibonacci Number does not check: Whether the first number entered by the user is less than or equal to the second number and whether both the numbers are nonnegative. Whether the user entered a valid value for the position of the desired number in the Fibonacci sequence. Rewrite that program so that it checks for these things. the program: //************************************************************* // Author: D.S. Malik // // Program: nth Fibonacci number // Given the first two numbers of a Fibonacci sequence, this // determines and outputs the desired number of the Fibonacci // sequence. //************************************************************* #include <iostream> using namespace std; int main() { //Declare variables int previous1; int previous2; int current; int counter; int nthFibonacci; cout << "Enter the first two Fibonacci numbers: "; //Step 1 cin…arrow_forward15, Exercises 1. Writea G-+ program that receives o integervalues frou heuser. The program then shaald print the (addition) (subiaction)(multplication), (division), and remainder aficr division (modulus). Your program must us only intcgers.arrow_forward
- This question is Chapter 5 Program exercise 12arrow_forwardPlease help with question 8 CSE PYTHON programs: 1. Program to Check Whether a Given Year is a Leap Year2. Program to Read Height in Centimeters and then Convert the Height to Feet and Inches3. Program to Take the Temperature in Celcius and Covert it to Farenheit4. Program to Compute Prime Factors of an Integer5. Program to Generate all the Divisors of an Integer6. Program to Print Table of a Given Number7. Program to Print Sum of Negative Numbers, Positive Even Numbers and Positive Odd numbers in a List8. Program to Print Largest Even and Largest Odd Number in a List9. Program to Find Those Numbers which are Divisible by 9 and Multiple of 3 in a Given Range of Numbers10. Program to Check if a Number is an Armstrong Number11. Program to Print the Pascal's triangle for n number of rows given by the user12. Program to Check if a Number is a Perfect Number13. Program to Check if a Number is a Strong Number14. Program to Find the LCM of Two Numbers15. Program to Find the GCD of Two…arrow_forwardCreate a program plan and algorithm for the following cases and write your answer on the table provided. 1.1 Suppose you want to create a program that would accept any number and computes the square, and square root the number readarrow_forward
- Read a positive integer value, and compute the following sequence: If the number is even, halve it; if it's odd, multiply by 3 and add 1. Repeat this process until the value is 1, printing out each value. Finally print out how many of these operations you performed. If the input value is less than 1, print a message containing the word “Error” and terminate the programarrow_forward5. The program snippet is known as follows: a = 10;b = 1;c = 2;do { b = b + 1 while (b <= 10) { if (a%2==0) c = c + b; a = a + 1; }} while (c < = 30); Please make a code generator for the above program fragment.arrow_forwardThe Salary Program: Modify the program from the textbook (Program 1-1,see below) which reads the number of hours an employee works reads the pay rate per hour computes the pay for the employee. Add the following steps: a) Read an amount of bonus paid to the employee.b) Compute the total pay as pay plus bonus.c) Compute the tax at 30% of the total pay.d) Compute the net pay as total pay minus tax, and e) Print a report showing: total pay, tax deduction, and net pay. Algorithm: 1. Prompt the user for number of hours.2. Read the value for hours.3. Prompt the user for hourly rate.4. Read the hourly rate.5. Prompt the user for amount of bonus.6. Read the value for bonus.7. Compute the pay.8. Compute the totalPay by adding bonus to pay.9. Compute the tax deduction by multiplying 30% times totalPay.10. Compute the netPay by subtracting tax from totalPay.11. Neatly print and label the following: a. totalPay b. tax c. netPay Put your…arrow_forward
- Exercise 15 Given the radius, in inches, and price of a pizza, design an algorithm to find the price of the pizza per square inch. You may assume that the value of π = 3.141593. In your program, declare a named constant PI to store this value. Below is an example of how the completed program should work:arrow_forward(Computation) A magic square is a square of numbers with N rows and N columns, in which each integer value from 1 to (N * N) appears exactly once, and the sum of each column, each row, and each diagonal is the same value. For example, Figure 7.21 shows a magic square in which N=3, and the sum of the rows, columns, and diagonals is 15. Write a program that constructs and displays a magic square for a given odd number N. This is the algorithm:arrow_forward(Numerical) a. Write a set of detailed, step-by-step instructions in English to calculate the fewest number of dollar bills needed to pay a bill of amount TOTAL. For example, if TOTAL is $97, the bills would consist of one $50 bill, two $20 bills, one $5 bill, and two $1 bills. (For this exercise, assume that only $100, $50, $20, $10, $5, and $1 bills are available.) b. Repeat Exercise 6a, but assume the bill is to be paid only in $1 bills.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning