This is a simple program to compute the sum of first 10 even and odd numbers and display the results.It is intended for beginner level learners of C programming.

The program is written and compiled using Dev-C++ 4.9.9.2 version compiler tool. You will find following sections in this post – problem definition, flowchart, program source code and verified output to help you understand and learn C programming language. Try to practice writing, compiling and run this program on your own.

### Problem Definition

The program for computing sum of first 10 even and odd numbers follow very simple logic, given below

- Take first 20 number, N = 20 of which half are even and half are odd numbers.
- Check each number one at a time and see if it’s divisible by 2.
- If Yes, add the number to Sum_Even.
- Else, add the number to Sum_Odd.
- Display the results
- End the program

Note:- Whenever a number is divisible by 2 it gives a remainder of 0, otherwise not.

### Flowchart

### Program Code

```
//Program to Compute Sum of first 10 Even and First 10 Odd Numbers
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
int main()
{
int sum_even,sum_odd,N,i;
clrscr();
//Initialize the sum of even and sum of odd numbers
sum_even = 0;
sum_odd = 0;
// Total of 20 numbers comprise of 10 odd and 10 even numbers
// But you change the value of N to anything if required
N = 20;
//Compute the sum of even and sum of odd number
for(i = 1;i<=N;i++)
{
if((i % 2) == 0)
{
sum_even = sum_even + i;
}
else
{
sum_odd = sum_odd + i;
}
}
//Print the results now
for(i=0;i<35;i++)
printf("_"); printf("\n\n");
cout << "The sum of 10 evens are" << "\t" << sum_even << endl;
cout << "The sum of 10 odd are" <<"\t" << sum_odd << endl;
for(i=0;i<35;i++)
printf("_"); printf("\n\n");
getch();
return 0;
}
```

### Output

The output of the program is given below. Remember that the program does ask for input because the value of N is already assigned. You can change that to a program asking input at run-time.