Question: I need help passing test case 4. I have attached the screenshot of my code and the test case that I cannot pass. In C
I need help passing test case 4. I have attached the screenshot of my code and the test case that I cannot pass. In C
Here is the assignment:
- The first 11 prime integers are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, and 31.
- A positive integer between 1 and 1000 (inclusive), other than the first 11 prime integers, is prime if it is not divisible by 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, and 31.
Write a program that:
- Prompts the user to enter a positive integer between 1 and 1000 (inclusive)
- Outputs whether the number is prime.
- If the number is not prime, then output all the numbers, from the list of the first 11 prime integers, which divide the number.
NOTE: Do not use loops or arrays to solve this problem! Yes, this means a LOT of if statements.
Example Output (sample user inputs are shown with an underline):
Enter an integer between 1 and 1000 (inclusive): 62 62 is divisible by 2, 31. 62 is not prime.
----------------------------------------------------
Enter an integer between 1 and 1000 (inclusive): -1 You must enter a number between 1 and 1000 (inclusive).
----------------------------------------------------
Enter an integer between 1 and 1000 (inclusive): 3 3 is prime.

Debugging Information for Test 4 O X None PROGRAM EXECUTION STACK TRACE None YOUR CODE'S OUTPUT Awni Enter an integer between 1 and 1000 (inclusive): 62 is divisible by 2, 3, 4, 6, 9, 12, 13, 18, 26, 36, 39, 52, 78, 117, 156, 234. 468 is not prime. THE CORRECT OUTPUT OF THE TEST CASE 1 Enter an integer between 1 and 1000 (inclusive): 2 468 is divisible by 2, 3, 13. 3 468 is not prime. 4 "UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 2c2 468 is divisible by 2, 3, 13. PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are missing, red indicates things in your output that shouldn't be there. The character refers to newlines, so the green - character refers a newline you are missing in your output and the red refers to a newline you need to remove from your output. 1 Enter an integer between 1 and 1000 (inclusive): 2 4628 is divisible by 2, 3, 4, 6, 9, 12, 13, 18, 26, 36, 39, 52, 78, 117, 156, 234.- 3 468 is not prime. 4 Testo 1/1 pts - Click for details PASSED #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
