15,921,774 members
See more:
You are given an array with 10 elements. i need to do the following things

a. Find and print the sum of all negative numbers in the array. (Note: - A number is
negative if it is less than 0)
b. Find and print the total number of occurrences of the number “0” in the array.
c. Print the elements in the array in the reverse order.

What I have tried:

C++
```#include <stdio.h>

void  main()
{
int arr[10];
int i;
printf("\n\nRead and Print elements of an array:\n");
printf("-----------------------------------------\n");

printf("Input 10 elements in the array :\n");
for(i=0; i<10; i++)
{
printf("element - %d : ",i);
scanf("%d", &arr[i]);
}

printf("\nElements in array are: ");
for(i=0; i<10; i++)
{
printf("%d  ", arr[i]);
}
printf("\n");
}```
C++
```
```
Posted
Updated 15-Feb-23 4:44am
v3

Solution 2

Quote:
for(i=0; i<10; i++)
{
printf("%d ", arr[i]);
}
The above code prints the array items in the input order, because `i=0,1,..9` changing to `i=9,8,..,0` (or simply using `j=9-i`) would do the trick.

Solution 1

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

Start by reading the question, and thinking about what you have to do. You will need a test: C If ... Else Conditions[^] to find negative numbers, and a loop that runs from `N - 1` to `zero` to print in reverse.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]