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
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
Write a program that reads ten integers, and then display the number of even numbers and odd numbers. Assume that the input ends with 0.
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_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_forwardWrite a program that reads at most 100 integers between 1 and 100 and counts the occurrence of each number. Assume the input ends with 0.arrow_forward
- Write a program to read the radian of a circle, check if it is bigger than zero, and if it is to calculate and display the perimeter of the circle using the formula P=2*3.14*R, where P is the perimeter and R is the radius of the circle. Otherwise it should prompt for the radius again until it is bigger than zero.arrow_forwardWrite a program that reads some integers between 1 and 100 and counts the occurrences of each.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_forward
- Write a program to print your name characters in this wayarrow_forwardWrite a program that reads an unspecified number of scores and determines how many scores are above or equal to the average and how many scores are below the average. Assume the input numbers are separated by onespace in one line.arrow_forwardWrite a program that receives an ASCII code (an integer between 0 and 127) and displays its character. For example, if the user enters 97, the program displays the character a.arrow_forward
- write a program that takes a string input from the user and calculates the sum of ASCII values of the vowels which are in even positions and multiply it to the sum of the even positions.arrow_forwardWrite a program that reads a four-digit integer, such as 2014, and then displays it, one digit per line in reverse order, like so: 4 1 0 2 Your prompt should tell the user to enter a four-digit integer. You can then assume that the user follows directions. (Hint: Use the division andm remainder operators.)arrow_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_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