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 13E
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 displays a random coordinate in a rectangle.The rectangle is centred at (0, 0) with width 50 and height 150.
Write a program that reads two points on a line, calculates the slope, and determines
whether the slope is positive, negative, zero, or undefined. Run your program for the
following pairs of points:
a. (-2, 1) and (2, 3)
b. (4,1) and (4,3)
A number is a palindrome if its reversal is the same as itself. An even palindrome number is a number which is even and also a palindrome. Write a program that displays the first 50 even palindrome numbers. Display 5 numbers per line and align the numbers properly.
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
What are the six common steps needed to access databases from a typical program?
Modern Database Management
This optional Google account security feature sends you a message with a code that you must enter, in addition ...
SURVEY OF OPERATING SYSTEMS
102* The sum of seven interior angles ofa closed-polygon traverse each read to the nearest
3 ” is
$99 a 59 '39...
Elementary Surveying: An Introduction To Geomatics (15th Edition)
T F: When a string variable is created in memory, Visual Basic assigns it the initial value 0.
Starting Out With Visual Basic (8th Edition)
Consider the following skeletal C program: void fun1(void); / prototype / void fun2(void); / prototype / void f...
Concepts Of Programming Languages
Suppose a machine language is designed with an op-code field of 4 bits. How many different instruction types ca...
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 that prompts the user to enter apoint (x, y) and checks whether the point is within the rectangle centred at (1, 1)with width 10 and height 5. For example, (2, 2) is inside the rectangle and (6, 4)is outside the rectangle, as shown in Figure . (Hint: A point is in the rectangleif its horizontal distance to (0, 0) is less than or equal to 10 / 2 and its verticaldistance to (0, 0) is less than or equal to 5.0 / 2. Test your program to cover allcases.) Here are two sample runs. Enter a point with two coordinates: 2 2 ↵EnterPoint (2.0, 2.0) is in the rectanglearrow_forwardWrite a program that plots the sine function in red and the cosecant function in blue. Hints: The above scene is 800 pixels wide and 600 pixels tall. On the x-axis, -2π is at pixel (200, 300),the center of the axis is at (400, 300), and 2π is at (600, 300). Draw your text for these points near (butnot directly on) these coordinates. The Unicode for π is \u03c0. To display -2π, use Text(x, y, “-2\u03c0”). My program used Font.font("Georgia", 25) as the font for each of the Text objects. (Recallthat you use the setFont(…) on a Text object to set its font. For a trigonometric function like Math.sin(x), x is in radians. You can use the following loop to add the points to a polyline for the sine curve: Polyline sineCurve = new Polyline(); ObservableList list = sineCurve.getPoints(); for (double x = -340; x <= 340; x++) {list.add(x + 400);list.add(300 – 100 * Math.sin((x / 200.0) * 2 * Math.PI)); Your program can draw the entire sine curve as a single polyline. Remember to set its color…arrow_forwardWrite a program that reads a one-line sentence as input and then displays the following response: If the sentence ends with a question mark (?) and the input contains an even number of characters, display the word Yes. If the sentence ends with a question mark and the input contains an odd number of characters, display the word No. If the sentence ends with an exclamation point (!), display the word Wow. In all other cases, display the words You always say followed by the input string enclosed in quotes. Your output should all be on one line. Be sure to note that in the last case, your output must include quotation marks around the echoed input string. In all other cases, there are no quotes in the output. Your program does not have to check the input to see that the user has entered a legitimate sentence.arrow_forward
- Design a program that asks the user to enter a string and then converts that string to Morse code. Morse code is a code where each letter of the English alphabet, each digit, and various punctuation characters are represented by a series of dots and dashes.arrow_forwardWrite a program that displays the first and last words of a sentence input by the user. Assume that the only punctuations is a period at the end of the sentences. Make it take in other punctuations as wellarrow_forwardWrite a program to print the lyrics for ten verses of "The Ants Go March-ing." A couple of sample verses are given below. You may choose your own activity for the "little one" in each verse, but be sure to choose somethingthat makes the rhyme work (or almost work). The ants go marching one by one, hurrah! hurrah!The ants go marching one by one, hurrah! hurrah!The ants go marching one by one,The little one stops to suck his thumb,And they all go marching down ...In the ground ...To get out ....Of the rain.Boom! Boom! Boom!The ants go marching two by two, hurrah! hurrah!The ants go marching two by two, hurrah! hurrah!The ants go marching two by two,The little one stops to tie his shoe,And they all go marching down ...In the ground ...To get out ...Of the rain.Boom! Boom! Boom!arrow_forward
- Write a program to get an integer input from the user. If the input is 25, take the length and breadth from the user and calculate the area of rectangle. [ Area of rectangle = length * breadth ] If the input is 40, get the side from the user and calculate the area of square. [ Area of square = side * side ] If the input is 65, get the radius from the user and calculate the area of circle. [ Area of circle = 3.14*r*r] Otherwise Display " Enter number 25 or 40 or 65 ".arrow_forwardCreate a new string from a string changing the position of first and last characters. The string length must be greater than or equal to 1. Take input the string from the user. Write program in Java.arrow_forwardWrite a program in BGI to draw a line using DDA algorithm when (? > 1) starting from (50, 100) to (250, 450). Use Yellow color for all pixel points with a window size of (600, 600) titled “DDA Algorithm”. (Note: the program should display error massages when the slope is equal or less than 1)arrow_forward
- Write a program that reads an integer and displays its first five multiples. For example, if the input integer is 10, the output should be as follows: 10, 20, 30, 40, 50.arrow_forwardWrite a program that asks the user for the radius of a circle, and depending on the user's choice, displays the corresponding diameter, circumference or area. Give the user multiple trials.arrow_forwardWrite a Python program that prints the (x, y) coordinates for an M by N image (with M=10 and N=5). Write Python program that will ask the user to enter a lower and upper range values and a divisor. Then the program must print all the integer numbers in that interval (including both bounds) that are divisible by the divisor. Write Python program that will ask the user to enter positive numbers, to end the program the user will enter a negative number. When this occurs, print the average of the positive numbers rounded to 2 decimal places. Write a Python program that uses a for-loop to print all integers between 300 and 600 (inclusive) that are divisible by both 3 and 5.Print how many of these numbers were found.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