C Program to display sum of even and product of odd numbers

By | 02.11.2016

Accept ten numbers and display the sum of even numbers and product of odd numbers


Write a C Program to Accept ten numbers and display sum of even and product of odd numbers. Here’s simple Program to Accept ten numbers and display sum of even and product of odd numbers in C Programming Language.


Below is the source code for C Program to Accept ten numbers and display sum of even and product of odd numbers which is successfully compiled and run on Windows System to produce desired output as shown below :


SOURCE CODE : :


/* C Program to Accept ten numbers and display sum of even and product of odd numbers */

#include<stdio.h>
#include<conio.h>

int main()
{
  int n,sum=0,mul=1,i;
  printf("Enter 10 numbers :: \n");
  for(i=0;i<10;i++)
  {
      printf("\nEnter %d number :: ",i+1);
        scanf("%d",&n);
      if(n%2==0)
        sum=sum+n;
      else
        mul=mul*n;
  }
  printf("\nThe sum of evennumbers is : %d \n",sum);
  printf("\nThe multiplication of odd numbers is : %d\n",mul);
return 0;
}

OUTPUT : :


Enter 10 numbers ::

Enter 1 number :: 1

Enter 2 number :: 2

Enter 3 number :: 3

Enter 4 number :: 4

Enter 5 number :: 5

Enter 6 number :: 6

Enter 7 number :: 7

Enter 8 number :: 8

Enter 9 number :: 9

Enter 10 number :: 0

The sum of evennumbers is : 20

The multiplication of odd numbers is : 945

Above is the source code for C Program to Accept ten numbers and display sum of even and product of odd numbers which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

4.5 4 votes
Article Rating
Category: Basic Programs C Programming Number Programs Tags:

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
sobhan

#include <stdio.h>

int main (){
    printf(“Enter 10 numbers : \n);
    int sum = 0;
    int multi = 1;
    int oddcounter=0;
    for(int i = 1; i <= 10 ; i++){
        int a;
        printf(“enter %d number\n,i);
        scanf(%d, &a);
        if(a%2==0){
            sum +=a;
        }
        else{
            multi = a * multi;
            oddcounter++;
        }
    }
    printf(“The sum of evennumbers is %d\n,sum);
    if(oddcounter>0){
    printf(“The multiplication of odd numbers is %d\n, multi);}
    else{
    printf(“The multiplication of odd numbers is 0\n);
    }
    return 0;
}