C Programming Language
2nd Edition
ISBN: 9780131103627
Author: Brian W. Kernighan, Dennis M. Ritchie, Dennis Ritchie
Publisher: Prentice Hall
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 1, Problem 20E
Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write an improved version of the chaos . py program from Chapter 1 thatallows a user to input two initial values and the number of iterations,
and then prints a nicely formatted table showing how the values changeover time. For example, if the starting values were . 25 and . 26 with 10iterations, the table might look like this:
index 0.25 0.26----------------------------1 0 . 731250 0 . 7503602 0 . 766441 0 . 7305473 0 . 698135 0 . 7677074 0 . 821896 0 . 6954995 0 . 570894 0 . 8259426 0 . 955399 0 . 5606717 0 . 166187 0 . 9606448 0 . 540418 0 . 1474479 0 . 968629 0 . 49025510 0.118509 0 . 974630
Write a program that prints out the letters of a word, one on each line, in the format "The letter is a."
Write a program that takes in an integer in the range 20-98 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical.
Ex: If the input is 93, the output is:
93 92 91 90 89 88
Ex: If the input is 77, the output is:
77
Ex: If the input is not between 20 and 98 (inclusive), the output is:
Input must be 20-98
For coding simplicity, follow each output number by a space, even the last one. Use a while loop. Compare the digits; do not write a large if-else for all possible same-digit numbers (11, 22, 33, ..., 88), as that approach would be cumbersome for large ranges.
Chapter 1 Solutions
C Programming Language
Ch. 1 - Run the hello, world program on your system....Ch. 1 - Prob. 2ECh. 1 - Modify the temperature conversion program to print...Ch. 1 - Write a program to print the corresponding Celsius...Ch. 1 - Prob. 5ECh. 1 - Prob. 6ECh. 1 - Write a program to print the value of EOF.Ch. 1 - Write a program to count blanks, tabs and...Ch. 1 - Write a program to copy its input to its output,...Ch. 1 - Write a program to copy its input to its output,...
Ch. 1 - Prob. 11ECh. 1 - Write a program that prints its input one word per...Ch. 1 - Write a program to print a histogram of the...Ch. 1 - Write a program to print a histogram of the...Ch. 1 - Rewrite the temperature conversion program of...Ch. 1 - Revise the main routine of the longest-line...Ch. 1 - Write a program to print all input lines that are...Ch. 1 - Write a program to remove trailing blanks and tabs...Ch. 1 - Write a function reverse(s) that reverses the...Ch. 1 - Write a program detab that replaces tabs in the...Ch. 1 - Write a program entab that replaces strings of...Ch. 1 - Write a program to fold long input lines into two...Ch. 1 - Prob. 23ECh. 1 - Write a program to check a C program for...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
In programming we use the term string to mean _____. a. many lines of code b. parallel memory locations c. stri...
Starting Out With Visual Basic (8th Edition)
The hypotenuse example script truncates the sides to integers, but outputs a floating-point number. Why? Adapt ...
Computer Science: An Overview (12th Edition)
Write a program that inputs two strings (either C-string or STL string) that represents a time of day using the...
Problem Solving with C++ (10th Edition)
The following program skeleton, when completed, will ask the user to enter 10 integers, which are stored in an ...
Starting Out with C++ from Control Structures to Objects (8th Edition)
Open the house project from Chapter 1 and review the Picture class. What types of object are created by the con...
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
How does method overloading improve the usefulness of a class?
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
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
- Write a python program that takes a string as an input from the user and checks if there are any groups of THREE consecutive vowels. The input string will be a random combination of small letter and capital letter characters. Then replace all the three consecutive vowels with “#” character. So, the presence of such a group is ensuredarrow_forwardWrite a program in phyton that takes in an integer in the range 11-100 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical.arrow_forwardIn Python, write an improved version of the chaos.py program that allows a user to input 2 initial values and the number of iterations and then prints a nicely formatted table showing how the values change over time. for example, if the starting values were .25 and .26 with 10 iterations, the table might look the attached table. Except write it to a file and the another program and print it from the file.arrow_forward
- Write a program that reads in lines from standard input with each line containing a name and two integers and then uses printf() to print a table with a column ofthe names, the integers, and the result of dividing the first by the second, accurate tothree decimal places. You could use a program like this to tabulate batting averages forbaseball players or grades for students.arrow_forwardWrite a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50, 60, 75, python please explainarrow_forwardWrite a program that continues accepting user inputs as float numbers until the input is an empty string (i.e., a user press Enter without any typing as the input), and then the program will print the largest number among the inputs. If no input is given, print an empty line.arrow_forward
- Write a program that gets a list of integers from input, and outputs negative integers in descending order (highest to lowest). Ex: If the input is: 10 -7 4 -39 -6 12 -2 the output is: -2 -6 -7 -39 For coding simplicity, follow every output value by a space. Do not end with newline.arrow_forwardWrite a program in Python whose input is two integers. Output the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer. Ex: If the input is: -15 30 the output is: -15 -5 5 15 25 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last.arrow_forwardWrite a python program that takes a string as an input from the user and then modifies the string in such a way that the string always starts with an uppercase letter and the case of each subsequent letter is the opposite of the previous letter (uppercase character followed by a lowercase character followed by an uppercase character and so on). Finally the modified string is printed to show the user.arrow_forward
- Write a program that reads a sequence of input values and displays a bar chart of the values, using asterisks - with captions- like this: Egypt ********************* France***************************** Japan ************************ Uruguay ******************** Switzerland **********arrow_forwardWrite a program that reads an integer age of kids, finds the maximum of them, and counts its occurances, finds the minimum of them, and counts its occurances. And Find the average ages. Assum that the input ends with number -1.arrow_forwardWrite a program whose input is two integers, and whose output is the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer. Ex: If the input is -15 30, the output is: -15 -5 5 15 25 Ex: If the second integer is less than the first as in 20 5, the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last.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
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY