Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 8, Problem 8.12HW
How many "hello'’ output lines does this
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Using SPIM, write and test a program that reads in a positive integer using the SPIM system calls. If the integer is not positive, the program should terminate with the message “Invalid Entry”; otherwise the program should print out the names of the digits of the integers, delimited by exactly one space. For example, if the user entered “728,” the output would be “Seven Two Eight.”
1. Write a program that does the following:
- reads an unspecified number of integers
- determines how many positive and negative values have been read
- computes the total and average of the input values (not counting zeros).
Your program ends with the input o.
Display the average as a floating-point number.
If the entire input is 0, the program displays "No numbers are entered except 0".
Here is a sample run:
Enter integers ending with 0: 1 2 -1 3 0
The number of positives is 3
The number of negatives is 1
The total is 5
The average is 1.25
2. A pentagonal number is defined as n(3n-1)/2 for n = 1, 2, . . ., etc.. Therefore,
the first few numbers are 1, 5, 12, 22, .. . . Write a method with the following
header that returns a pentagonal number:
public static int getPentagonalNumber(int n)
For example, getPentagonalNumber(1) returns 1
and getPentagonalNumber(2) returns 5. Write a test program that uses this method
to display the first 100 pentagonal numbers with 10 numbers on each…
1. Write a program that does the following:
- reads an unspecified number of integers
- determines how many positive and negative values have been read
- computes the total and average of the input values (not counting zeros).
Your program ends with the input 0.
Display the average as a floating-point number.
If the entire input is 0, the program displays "No numbers are entered except 0".
Here is a sample run:
Enter integers ending with e: 1 2 -1 3 e
The number of positives is 3
The number of negatives is 1
The total is 5
The average is 1.25
2. A pentagonal number is defined as n(3n-1)/2 for n= 1, 2, ..., etc.. Therefore,
the first few numbers are 1, 5, 12, 22, .... Write a method with the following
header that returns a pentagonal number:
public static int getPentagonalNumber(int n)
For example, getPentagonalNumber(1) returns 1
and getPentagonalNumber(2) returns 5. Write a test program that uses this method
to display the first 100 pentagonal numbers with 10 numbers on each line.…
Chapter 8 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 8.2 - Prob. 8.1PPCh. 8.4 - Prob. 8.2PPCh. 8.4 - Prob. 8.3PPCh. 8.4 - Prob. 8.4PPCh. 8.4 - Practice Problem 8.5 (solution page 797) Write a...Ch. 8.4 - Practice Problem 8.6 (solution page 797) Write a...Ch. 8.5 - Practice Problem 8.7 (solution page 798) Write a...Ch. 8.5 - Prob. 8.8PPCh. 8 - Prob. 8.9HWCh. 8 - In this chapter, we have introduced some functions...
Ch. 8 - How many hello output lines does this program...Ch. 8 - How many "hello' output lines does this program...Ch. 8 - Prob. 8.13HWCh. 8 - How many hello output lines does this program...Ch. 8 - How many "hello lines does this program print?Ch. 8 - Prob. 8.16HWCh. 8 - Prob. 8.17HWCh. 8 - Consider the following program: Determine which of...Ch. 8 - How many lines of output does the following...Ch. 8 - Use execve to write a program called my1s whose...Ch. 8 - What are the possible output sequences from the...Ch. 8 - Write your own version of the Unix system function...Ch. 8 - One of your colleagues is thinking of using...Ch. 8 - Modify the program in Figure 8.18 so that the...Ch. 8 - Write a version of the fgets function, called...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Determine the components of reaction that the thrust bearing A and cable BC exert on the bar. Prob. F5-12
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Summarize the booting process.
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
In Exercises 49 through 54, find the value of the given function. Math.Round(2.6)
Introduction To Programming Using Visual Basic (11th Edition)
Find the no-load value of υo in the circuit shown.
Find υo when RL is 150 Ω.
How much power is dissipated in th...
Electric Circuits. (11th Edition)
Porter’s competitive forces model: The model is used to provide a general view about the firms, the competitors...
Management Information Systems: Managing The Digital Firm (16th Edition)
(Separating the Digits in an Integer) Write an application that inputs one number consisting of five digits fro...
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Hello,it shows that '' instead of 2 rows, your program prints out 1 rows''arrow_forwardHello...Its not correct....arrow_forwardRead floating-point numbers from input until a floating-point number is read that is not in the range -45.0 to 15.0, both exclusive. For each floating-point number read that is in the given range, output the floating-point number followed by " is accepted". Then, output the floating-point number read that causes the reading to stop followed by " is rejected". End each output with a newline. Ex: If the input is -41.6 -37.8 -35.5 -38.4 -42.3 -49.5 -36.9 -41.1, then the output is: -41.6 is accepted -37.8 is accepted -35.5 is accepted -38.4 is accepted -42.3 is accepted -49.5 is rejected 1 #include 2 using namespace std; 3 4 int main() { 5 167899 10} double dataValue; /* Your code goes here */ return 0;arrow_forward
- Hello...Its not correct...arrow_forwardA palindromic number is a number that is the same when written forwards or backwards. The first few palindromic numbers are therefore are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 323 Input a number from the user. Write a program that reverses the digits of a number. Use this program to find if the number is a palindrome. Print if the number is palindrome or not.arrow_forwardCode in Java. Instructions attachedarrow_forward
- Do all!. I need as soon asarrow_forwardWrite a program that calculates the equivalent resistance of a circuit. n electrical resistors with resistance values R1, R2,.., Rn are said to be connected in parallel if the same voltage is applied across each. Their equivalent resistance Reg is related to the values R1, R2, ..., Rn by: 1 1 1 1 + +...+ R R R, R. "eq Write a program that prompts the user to enter the resistance of n resistors. The user should be prompted continuously by using a while loop until a zero or negative value is entered (the program should count the number of resistors n entered by the user and store the values in an array). Use another separate loop to print the resistance values entered by the user and the equivalent resistance Reg. Test your program with R1= 1 kn, R2= 2 kn, R3= 4 kQ and R4= 8 kQ.arrow_forwardCan you use Python programming language to to this question? Thanksarrow_forward
- Do in Assembly language only! Code with comments and output screenshot will be Upvoted else downvoted. Thank you!arrow_forwardWrite a Java program that prompts the user to enter two positive integers and find their greatest common divisor as below (do it using while or do-while loop only) Enter first integer: 125 tr Enter second integer: 2525 ar The greatest common divisor for 125 and 2525 is 25arrow_forwardWrite a program that reads two integers, a and b, from the user. Where a is equal to 17 and b is equal to 4. The program should compute and display the following: i. Sum of a and b. ii. Difference when b is subtracted from a. ii. Result of a. iv. Remainder when a is divided by b.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Introduction to Operators in C; Author: Neso Academy;https://www.youtube.com/watch?v=50Pb27JoUrw;License: Standard YouTube License, CC-BY