Problem 1: Basic Mathematical Operations

Create a C program that will input N number and create a function that determines the following SUM, AVERAGE, EVEN Numbers ODD Numbers, Prime Numbers and FACTORIAL of the given N integers.

Consider the following sample output.

Enter N numbers: 10

Value of number 1-3
Value of number 2-3
Value of number 3-7
Value of number 4-3
Value of number 5- 2
Value of number 6- 3
Value of number 7- 45
Value of number 8- 4
Value of number 9 - 3
Value of number 10-19

Sum: 92
Average: 9.2

EVEN Numbers: 2, 4

ODD Number: 3,3,7,7,3,45,3,19

PRIME Numbers: 3,3,7,3,2,3,3

Factorial:
Value 1- 3 = 6
Value 2- 3 = 6
.
.
.
Value 10 – 19 = ?

Code:
```#include<stdio.h>
#include<conio.h>
int sum (int);
float ave (float,float);
int even (int);
int main()
{
int count,hold,num,sumall=0;
clrscr();
printf("\nEnter N numbers: "); scanf("%d",&hold);
for (count=1;count<=hold;count++)
{
printf("Value of number %d-",count);
scanf("%d",&num);
sumall=sumall+sum(num);
if (count==hold)
{
printf("\nSum:%d",sumall);
printf("\nAverage:%.1f",ave(sumall,hold));
}
}
getch();
return 0;
}

int sum (int a)
{
int sum1;
sum1=0;
sum1=a+sum1;
return (sum1);
}

float ave (float b, float c)
{
float ave1;
ave1=b/c;
return ave1;
}```
I am stuck at average because i don't know what is next now please me

2. Announcements - C Programming

And

A development process

So do the ? at the end of your post mean you're only having a problem with factorial?

You really need to post some code if you want the "fellow programmers" moniker to stick.
Because without code, you're no programmer.

3. i am hard now at the succeeding functions to create sir. please help. I am begging you

Originally Posted by Salem
Announcements - C Programming

And

A development process

So do the ? at the end of your post mean you're only having a problem with factorial?

You really need to post some code if you want the "fellow programmers" moniker to stick.
Because without code, you're no programmer.

4. Do you know about arrays yet?

5. we did not yet tackled that sir. but if your willing to help sir i'll be so thankful to you X)

6. For example
Code:
```int array[10];
for ( i = 0 ; i < 10 ; i++ ) {
scanf("%d", &array[i] );
}```
Then you can declare a function, such as
Code:
```void sum ( int array[10] ) {
int result = 0;
for ( i = 0 ; i  < 10 ; i++ ) {
result += array[i];
}
}```
All your other program features can be implemented as a function, taking an array parameter, and using a for loop to process each element of the array.

For additional bonus points, make the 10 constant an additional parameter to each function.

7. about the problem i posted sir. how can i print all the even numbers that the user inputted as well as the odd numbers

8. if number%2==0 then print evens

In addition you can do this with odds as well.

if number%2!=0 then print odds

9. I'm sensing homework by successive approximation.

Especially when you keep bouncing back within 5 minutes of each post.

There's no way you read the information provided and tried to apply it to your own situation.