an orthogonal triangle input from a file and you need to find the maximum sum of the numbers according to given rules below; 1. You will start from the top and move downwards to an adjacent number as in below. 2. You are only allowed to walk downwards and diagonally. 3. You can only walk over NON PRIME NUMBERS. 4. You have to reach at the end of the pyramid as much as possible. 5. You have to treat your input as pyramid. According to above rules the maximum sum of the numbers from top to bottom in below example is 24. *1 *8 4 2 *6 9 8 5 *9 3 As you can see this has several paths that fits the rule of NOT PRIME NUMBERS; 1>8>6>9, 1>4>6>9, 1>4>9>9 1 + 8 + 6 + 9 = 24. As you see 1, 8, 6, 9 are all NOT PRIME NUMBERS and walking over these yields the maximum sum.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

You will have an orthogonal triangle input from a file and you need to find the maximum sum of the numbers according to given rules below; 1. You will start from the top and move downwards to an adjacent number as in below. 2. You are only allowed to walk downwards and diagonally. 3. You can only walk over NON PRIME NUMBERS. 4. You have to reach at the end of the pyramid as much as possible. 5. You have to treat your input as pyramid. According to above rules the maximum sum of the numbers from top to bottom in below example is 24.

*1

*8 4

2 *6 9

8 5 *9 3

As you can see this has several paths that fits the rule of NOT PRIME NUMBERS; 1>8>6>9, 1>4>6>9, 1>4>9>9 1 + 8 + 6 + 9 = 24. As you see 1, 8, 6, 9 are all NOT PRIME NUMBERS and walking over these yields the maximum sum.

Write code for below problem in C language

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
InputStream
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT