Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1. Which position would you take?

Answered: 1 week ago