Understanding an exercise about sub-sums in arrays

P

p_ei

Hello everyone,

I'm very new to C so I cannot understand how to define a solution for my task. I'm here to ask a little help in understanding and solving it.

So,

I've got an array of integer numbers (size N), let's name it a.

I have to create a function that return 1 if every number of the array is the sum of the two previous one.


Thanks for the help!
 
Last edited by a moderator:
Joined
Sep 4, 2022
Messages
128
Reaction score
16
let see few elements :
  • an 'Array' with name 'a'
  • a series of integers

- a special constraint to check :
all elements following each others which sum of third is equal the two integers before.


we can say that 'a' must be - > at less < - : of a size = 3.
and an array must be 'iterate', an Array must be 'fetch' : a loop will be useful.

so for your code :
you have to declare :
an array ( random size ) with integers in.
and to fetch the array, you need a loop.
a test will check if the third number of a series equal the first and the second in a sum.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top