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
- Harlan A. Brothers and John A. Knox discovered that as the value of x gets larger, the value of the expression gets closer and closer to e. Write a program that evaluates this expression for x = 1, 2, 3, and so on until the absolute difference between the expression’s value and the value of e calculated by the library function (exp) is less than 0.000001. Display the value of x that causes your loop to exit along with both the final approximation of e and the value of e calculated by the (exp) function. Show seven decimal places. IN C
PROGRAMMING LANGUAGE PLEASE AND COMMENT EVERY STEP OF IT
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
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
- How many times will the following do-while loop be executed? int x = 0; do { System.out.println(”looping through…”); x += 25; } while (x > 50); a) 0 b) 1 c) 2 d) 3arrow_forwardWrite a program to simulate how a for loop works with the range. The input to your program are two integers start and stop. Check that the second integer stop is not less than or equal to the start. If the second integer stop is less than the first start, then see the example output below. Otherwise, (if the stop is less than the start) proceed with the rest of the program. Output the value of the start and keep subsequently incrementing it by 5 as long as the value is less than the stop. Input (1) : 20 5 --> the output is: There won't be any output sequence if the second integer is less than or the same as the first. input (2) :-15 10 the output is: -15 -10 -5 0 5 Use the if/else statements to run a preliminary check of the input before taking other actions Use the print() statement inside the loop Provide the end argument to the print() to correctly generate the output sequencearrow_forwardWrite a program that reads in numbers from the user and outputs the information specified below. Part One: Get Valid Input Read in two integers from the user: a lower end of a range and an upper end of a range. Check if the numbers are valid (lower cannot be greater than upper). If the numbers are invalid, use a loop to ask for new numbers. Continue looping until you get two valid values. Part Two: Calculate the Sum Use a loop to calculate the sum of all values from lower (inclusive) to upper (inclusive). Output the sum to the user. Part Three: Analyze the Sum Determine if the sum is even or odd. Determine if the sum is positive, negative, or zero. Output this information to the user. Part Four: Calculate the Average Calculate the average of all numbers in the range from lower (inclusive) to upper (inclusive). Style and Additional Coding Requirements code should compile properly space and indent your code follow Java naming conventions for variables (lower camel case with no…arrow_forward
- loop-2.py In your program ... Ask the user for a small number. see hints Welcome to our counting program. Then, ask the user for a larger number to count up to. *see hints It also adds up the digits that you count! Please enter a small number, 0 or higher: five Your program should use a for loop and the range function to print the numbers counted, and add each one to the next, from the small number to the large number. Display the total in a good-looking print statement as shown. Please enter a whole number only: 5 Now, enter a larger number that you want to count up to: 3 Enter a whole number greater than your start number (5): 10 08 6. 7 *Hint 1: the two user-defined numbers will become the start and stop values for your range 9. 10 function. The total of all the numbers you counted is: 45. *Hint 2: int validation required. In addition to requiring whole numbers for both inputs, the second number has to be greater than the first number.arrow_forwardsolve code in matlabarrow_forwardThe program should be written in python 1. first ask the user to enter the number of students in the range of 1 to 10. 2. then the program asks the user to enter the number of tests (in the range of 1 to 5) 3. Then use a loop to collect the scores for those many tests for each student. The outer loop will iterate once for each student. The inner loop will iterate several times, once for each test. Each iteration of the inner loop will ask the user to enter the score for a test of a student. 3. After all iterations, the program should calculates and display the total scores and average score for each student.arrow_forward
- Write a program using do-while loop that: Asks the user to enter a number between 0 and 99 (inclusive). If the number is not valid, then it should continue asking the user for a valid numbr If the number entered is valid, then use a for loop to print a countdown from the number entered down to 0.arrow_forwardPositive loops have a tendency to reinforce the original action. O True Falsearrow_forwardWrite a program that asks the user to enter how many students they have. Use a for loop to iterate through each student. For each student, allow the user to enter as many scores as they want and let them know that entering -1 will indicate the end of entering scores( note: use a while loop with sentinel value). Sum all the scores for each student and display the total on the screen . For example: Student 1 Total score is 340 Student 2 Total score is 200arrow_forward
- for a in range(5,17,3): How many times the loop statement will run?arrow_forwardWrite a while loop that prints the multiples of 3 from 300 down to 3. The programming language is java.arrow_forwardConstruct a single for loop to print out the following lines. You may use as many variables as you wish, but you may not use multiple loops. 4 4 4 8 2 7 16 1 10 32 0.5 13 64 0.25 16arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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