Task using C language Write a program that checks both of the following conditions hold for a given array a1, a2, …, an. If the conditions hold, display “yes”, otherwise, display “no”. a1 < a2 < … < an For every i from 2 to n, ai isn’t divisible by ai-1. Requirements Follow the format of the examples below. The program reads in the number of elements of the array, for example, 4, then read in the numbers in the array, for example, 3 6 8 9. In the main function, declare the input array after reading in the number of elements of the array, then read in the elements. Examples (your program must follow this format precisely) Example #1 Enter the length of the input array: 7 Enter the array elements: 2 5 4 1 6 9 12 Output: no Example #2 Enter the length of the input array: 6 Enter the array elements: 2 7 13 19 23 43 Output: yes

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.4: Arrays As Arguments
Problem 6E: (Electrical eng.) Write a program that declares three one-dimensional arrays named volts, current,...
icon
Related questions
Question

Task using C language

Write a program that checks both of the following conditions hold for a given array a1, a2, …, an. If the conditions hold, display “yes”, otherwise, display “no”.

  1. a1 < a2 < … < an
  2. For every i from 2 to n, ai isn’t divisible by ai-1.

Requirements

  1. Follow the format of the examples below.
  2. The program reads in the number of elements of the array, for example, 4, then read in the numbers in the array, for example, 3 6 8 9.
  3. In the main function, declare the input array after reading in the number of elements of the array, then read in the elements.

Examples (your program must follow this format precisely)

Example #1

Enter the length of the input array: 7
Enter the array elements: 2 5 4 1 6 9 12
Output: no

Example #2

Enter the length of the input array: 6
Enter the array elements: 2 7 13 19 23 43
Output: yes 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Program on Numbers
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning