can someone please solve this i been working on this all evening please!!!

will you help me write a program that creates an array of 10 random numbers between 10 and 20. the program will total the number of even numbers of even numbers and odd numbers and display those values. use a function for filling the array .create another function to zero out the array-set all elements to 0 . a third function will determine what is even and what is odd and total each type .you will need to return the totals back to the main program to display . continue to fill and calculate until you decide to quit b y enter a 'q' to quit.
This should help you get started:
write a program
1
2
3
4
int main()
{
    return 0;
}

that creates an array of 10
1
2
3
4
5
6
int main()
{
    const size_t arraySize = 10;
    int myArray[arraySize];
    return 0;
}

use a function for filling the array
1
2
3
4
5
6
7
8
9
10
11
12
13
void fillArray(int anyArray[], int sizeOfArray)
{
    // assign each of anyArray[0] to anyArray[sizeOfArray - 1]
    // a random number between 10 and 20
}

int main()
{
    const size_t arraySize = 10;
    int myArray[arraySize];
    fillArray(myArray, arraySize);
    return 0;
}

create another function to zero out the array-set all elements to 0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void fillArray(int anyArray[], int sizeOfArray)
{
    // assign each of anyArray[0] to anyArray[sizeOfArray - 1]
    // a random number between 10 and 20
}

void zeroOutArray(int anyArray[], int sizeOfArray)
{
    // set each of anyArray[0] to anyArray[sizeOfArray - 1] to zero
}

int main()
{
    const size_t arraySize = 10;
    int myArray[arraySize];
    fillArray(myArray, arraySize);
    zeroOutArray(myArray, arraySize);
    return 0;
}
#include <stdio.h>

int main()
{
int num1 = 0, num2 = 0, num3 = 0;

while(num1 != -1)
{
// read and store an integer from user
printf("Enter an integer, -1 to stop: ");
scanf_s("%d", &num1);
// check whether user want to stop or not
if(num1 != -1)
{
// Let determine the divisibility of 5 and 6
num2 = num1 % 5; // num2 = 0, divisible
num3 = num1 % 6; // num3 = 0, divisible

// in this example, all three conditions must be tested
// do the equality comparison
// Divisible by 5 AND 6?
if((num2 == 0) && (num3 == 0))
printf("Is %d divisible by 5 and 6? true\n", num1);
else
printf("Is %d divisible by 5 and 6? false\n", num1);

// Divisible by 5 OR 6?
if((num2 == 0) ||(num3 == 0))
printf("Is %d divisible by 5 or 6? true\n", num1);
else
printf("Is %d divisible by 5 or 6? false\n", num1);

// Divisible by 5 OR 6 but NOT both?
if(((num2 == 0) ||(num3 == 0)) && !((num2 == 0) && (num3 == 0)))
printf("Is %d divisible by 5 or 6 but not both? true\n", num1);
else
printf("Is %d divisible by 5 or 6 but not both? false\n", num1);
}
// clean up
// num1 = 0;
printf("\n");
// check the while condition
}
// exit message
printf("You asked to stop. Thank you!\n");
return 0;
}
Topic archived. No new replies allowed.