-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathevenoddsum.c
More file actions
42 lines (36 loc) · 926 Bytes
/
Copy pathevenoddsum.c
File metadata and controls
42 lines (36 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/
/*WAP to read ten integers from the keyboards and print the sum of even and odd numbers.*/
#include<stdio.h>
int main()
{
int a[10];
int i,sumeven=0,sumodd=0;
printf("Enter ten Integers:\n");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<10;i++)
{
if(a[i]%2==0)
{
sumeven=sumeven+a[i];
}
else
{
sumodd=sumodd+a[i];
}
}
printf("\nSum of even numbers is: %d", sumeven);
printf("\nSum of odd numbers is: %d", sumodd);
return 0;
}