Write a c program to read 10 values Store them in an array a

Write a c program to read 10 values. Store them in an array according to the following criteria

If the value is positive store it at the even index

If the value is negative store it at the odd index.

The output may look like this:

0ut put:

10

-2

90

-8

4

-30

27

6356884

30

4200768

Solution

Solution :

Since in the input array there are only 3 negative integers.

You didn\'t define the possibility: if( negative numbers in array< Number of odd positions in array) .So the remaining odd places by default c compiler assigns 0 to the remaining odd places in the array

So define the possibility what happens when if there are less number of nagative numbers than number of odd positions . Then your problem is solved.

I hope this helps you.

Write a c program to read 10 values. Store them in an array according to the following criteria If the value is positive store it at the even index If the value

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site