Question: Write a C program that prompts the user to enter N integers and checks whether there exist three consecutive odd integers. Accordingly, your program should:

Write a C program that prompts the user to enter N integers and checks whether there exist three consecutive odd integers. Accordingly, your program should:
Prompt the user to enter N the number of integers in the list (greater than three and less than 20)
Prompt the user to enter the N integers and check if there exist three consecutive odd integers.
After the user enters the N integers, your program should display a message indicating whether there exist three consecutive odd integers as shown below.
In this problem, you are required to submit two solutions (1) without using arrays and (2) with arrays
Hint: For (1), you need to keep record of the last three integers entered by the user. Accordingly, you need to track the number entered at iteration i, the previous numbers entered i1 and i2.
Note: If you need to use variables of type bool, you need to add #include
Sample input/output 1:
Please enter N the number of integers in the list: 6
Please enter the 6 integers:
567899
Three consecutive odd integers? NO
Sample input/output 2:
Please enter N the number of integers in the list: 8
Please enter the 8 integers:
13657984
Three consecutive odd integers? YES

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!