Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Write a
However, there are three special cases where instead of printing the number, you
print a message in its place:
1. If the number you would print is divisible by 3, print the message: Better three
hours too soon than a minute too late.
2. If the number you would print is divisible by 5, print the message: Where do
you see yourself in five years?
3. If the number you would print is divisible by both 3 and 5, instead print out: In
the future, everyone will be world famous for 15 minutes.
Make sure to print the exact strings given above!
Expert Solution
arrow_forward
Step 1
Here's the program in C that satisfies the given requirements:
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps
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 asks the user to enter 10 numbers, that range from 0-100. Make sure that you do not accept any numbers less than 0, if a user enters a number that is less than 0 then ask him again. Once the user enters all 10 numbers, find and print out the median. How to calculate the Median The median is the middle score of a distribution. To calculate the median Arrange your numbers in numerical order. Count how many numbers you have. If you have an odd number, divide by 2 and round up to get the position of the median number. If you have an even number, divide by 2. Go to the number in that position and average it with the number in the next higher position to get the median. Consider this set of numbers: 5, 7, 9, 9, 11. Since you have an odd number of scores, the median would be 9. You have five numbers, so you divide 5 by 2 to get 2.5, and round up to 3 (to round numbers in C#, use Math.Round()). The number in the third position is the median. In this case, the mean…arrow_forwardWrite a program that asks a user to input the height of triangle and draw a triangle that has the following pattern If the user enter height as 4 Then the triangle output is 1 1 2 1 2 3 1 2 3 4 We make the following assumptions There is no space between the margin and 1 There is no space after the last number on every line There is one space between numbers on every line • There is no newline at the end of last line the height of the triangle is an integer between 1 and 9arrow_forwardWrite a program which: 1. prints all multiples of 5 between 5 and 50 inclusive and then 2. reads a number from the user and prints out if it is zero, above zero, or below zeroarrow_forward
- Write a program that asks a user to input non-negative integers (numbers that are >=0) until the user enters a negative number (< 0).If odd the user gets 1 point if even user gets 0 points. Output the total number of points If the user the following numbers: 3 5 2 -9 Then the points gained is 1+1+0+0 = 2 points since 3 is odd so 1pt, 5 is odd so 1 pt, 0 is even so Opt, 2 is even so 0 pt and program quits since -9 is negative We make the following assumptions • O is even number • no newline after the outputarrow_forwardStatistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the max and average, respectively. Output the max and average with two digits after the decimal point. Ex: If the input is: 14.25 25 0 5.75 the output is: 25.00 11.25 461710 3116374.qx3zqy7 LAB ACTIVITY 6.7.1: LAB: Varied amount of input data 0/10arrow_forwardImplement a program that requests four numbers from the user. Your program should compute the average of the first three numbers and compare the average to the fourth number. If they are equal, your program should print Truearrow_forward
- Write a program that converts a positive integer into the Roman number system. The Roman number system has digits Arabic Roman 1 I 5 V 10 X 50 L 100 C 500 D 1000 M Numbers are formed according to the following rules: a. Only numbers between 1 and 3,999 are represented. b. As in the decimal system, the thousands, hundreds, tens, and ones are expressed separately. c. The numbers 1 to 9 are expressed as Arabic Roman 1 I 234567 || |||| IV V VI VII 8 VIII 9 IX As you can see, an I preceding a V or X is subtracted from the value, and you can never have more than three I's in a row. d. Tens are expressed as Arabic Roman 10 X 20 XX 30 XXX 40 XL 50 L 60 LX 70 LXX 80 LXXX 90 XC As you can see, an X preceding a L or C is subtracted from the value, and you I can never have more than three X's inarrow_forwardWrite a program that displays a table of speeds in kilometers per hour with their values converted to miles per hour. The table should display the speeds from 40 kilometers per hour through 120 kilometers per hour, in increments of 5 kilometers per hour. (In other words, it should display 40 kph, 45 kph, 50 kph and so forth, up through 120 kph.) MPH = KPH * 0.6214arrow_forwardWrite a program 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. Additionally, output the distance between the starting and ending numbers (ex: 93 - 88 = 5) Note: End with a newline. Ex: If the input is: 93 the output is: 93 92 91 90 89 88 5 Ex: If the input is: 11 the output is: 11 0 Ex: If the input is: 9 or any value not between 11 and 100 (inclusive), the output is: Input must be 11-100 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, …, 99), as that approach would be cumbersome for larger ranges. Hint: To practice incremental development, start by writing code that just outputs the countdown until matching digits and submit to get most of the points. Then, update your code to output the distance.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education