subject

Three functions are required:get_input():This function takes no parameters, but will ask the user for an integer number. It will return a valid integer. You will use an indefinite loop and exception handling like we discussed in class. It is required to catch user input error and gracefully recover. Learn about the continue keyword and how it works in a loop; it can be handy. is_prime(n):This function will take an integer parameter n, and return True if the number is prime, or return False if it is not prime. You can use this pseudocode for primality testing to write this function. main():This does the bulk of your program’s work for solving Goldbach’s conjecture. You will call get_input() and is_prime(n) from main().Goldbach’s conjecture itself will be solved using an indefinite loop. Particularly a ‘post-test’ loop pattern. A for loop will not be accepted as part of the solution. OutputA successful run:This program tests the Goldbach's conjecturePlease enter an even integer larger than 2: 3636 = 5 + 31A run recovering from errors:This program tests the Goldbach's conjecturePlease enter an even integer larger than 2: 7Wrong input!Please enter an even integer larger than 2: fooBad input!Please enter an even integer larger than 2: 88 = 3 + 5If by chance the number chosen is valid, but doesn’t hold for Goldbach’s conjecture, then print:Goldbach's conjecture doesn't hold for [whatever the number is]

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:00, king514
6. the is particularly susceptible to the effects of alcohol because it receives a large portion of total blood flow and has a high concentration of neurons. a. heart b. pancreas c. brain d. liver
Answers: 2
image
Computers and Technology, 22.06.2019 03:20, owoeli
Which of these is a benefit of social networking? oa. hiding your true identity from friendsob. avoiding talking to people in personoc. spending time with friends instead of studyingod. connecting with new people
Answers: 2
image
Computers and Technology, 23.06.2019 09:50, tatumleigh04
Allison and her group have completed the data entry for their spreadsheet project. they are in the process of formatting the data to make it easier to read and understand. the title is located in cell a5. the group has decided to merge cells a3: a7 to attempt to center the title over the data. after the merge, allison points out that it is not centered and looks bad. where would the title appear if allison unmerged the cells in an attempt to fix the title problem?
Answers: 2
image
Computers and Technology, 24.06.2019 20:00, Cookie320
Write c++programs for the following problem: let the user enter two numbers and display which is greater. !
Answers: 1
You know the right answer?
Three functions are required:get_input():This function takes no parameters, but will ask the user fo...

Questions in other subjects:

Konu
Mathematics, 14.04.2020 19:47