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
Concept explainers
Textbook Question
Chapter 1, Problem 17E
Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program that reads a line of characters (ending with newline) from the standard
Asap.
Write a program which repeatedly reads several people's height numbers in cm(centimeter) until the user enters "done". Once "done" is
entered, print out the max, min, and average of the height numbers. Correct height data should be number between 50cm and 250cm. If the
user enters number out of the range, or anything other than a number, detect the mistake and print an error message and skip to the next
number.
Sample input and output:
Enter a height: 300
Invalid input
Enter a height: 10
Invalid input
Enter a height: 200
Enter a height: good
Invalid input
Enter a height: 180
Enter a height: 165
Enter a height: done
Max: 200.0
Min: 165.0
Average: 181.67
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
You cannot display the contents of the counter variable in the body of a loop.
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
State the order of evaluation of the operators in each of the following C statements and show the value of x af...
C How to Program (8th Edition)
Grade point average (GPA) in a 4-point scale is calculated by using the following formula:
Write a program t...
Absolute Java (6th Edition)
Consider the following union declaration: This declaration illustrates that structures can be embedded within u...
Computer Systems: A Programmer's Perspective (3rd Edition)
What is the difference between application software and utility software?
Computer Science: An Overview (13th 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 program to take user input for a string, find the length of that string i.e. count the number of characters in that string.arrow_forward6. Write a program that reads in an integer and breaks it into a sequence of individual digits. For example, the input 16384 is displayed as 16384 You may assume that the input has no more than five digits and is not negative.arrow_forwardWrite a program that reads from the user a character ('q' or 'c'). If the character is 'c', the program reads from the user the radius rof a circle and prints its area. • If the user enters 'q', the program asks the user to enter the length and width of a quadrilateral. We assume the quadrilateral is either a square or rectangle. You should print if the quadrilateral is square or rectangle. • Otherwise, it prints "Wrong character" PS: Use the following formulas: area of circle=3.14*r Sample Run1: Enter a character (q or c): q Enter the Length and Width: 80 150 |It is a rectangle Sample Run2: Enter a character (q or c): q Enter the Length and Width: 80 80 It is a square Sample Run3: Enter a character (q or c): c Enter the radius: 2 The area of the circle is 12.56 Sample Run4: Enter a character (q or c): d Wrong characterarrow_forward
- Can you use Python programming language to to this question? Thanksarrow_forwardPython please: Write a program with an input that is a string and a number. Output the first character in the string and then the character that is the number's distance away from the previous character, repeating for the remainder of the string as long as the string is longer than the increment number. Your output wording should match the below examples. For example, if the input is hello 2 the output is h l o If the string contains fewer characters than the input number, as in cat 4 the output is The integer can't be higher than the string length. For coding simplicity, output a space after every character, including the last.arrow_forwardUse SPIM to write a program that reads in three integers and prints out the sum of the largest two. The program also prints out the largest and smallest of the three integers.arrow_forward
- Write a program that reads from the user a character (*q' or 'c'). If the character is 'c', the program reads from the user the radius r of a circle and prints its area. If the user enters 'q', the program asks the user to enter the length and width of a quadrilateral. We assume the quadrilateral is either a square or rectangle. You should print if the quadrilateral is square or rectangle. Otherwise, it prints "Wrong character" PS: Use the following formulas : area of circle=3.14*r? Iarrow_forwardWrite a program that prints the characters in the ASCII character table from ! to ~. Display 10 characters per line. The ASCII table is given in Appendix B. Characters are separated by exactly one space.arrow_forwardQ48. Write a program to convert a given number into hours and minutes. Separate the number of hours and minutes using a colon. Also use flag in the program. For example if a given number is 99 the output should be 1:39. Use number 99,199,299,399 for the programarrow_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
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY