Q:

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

0

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

 
 

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 .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Number Solved Programs – C Programming

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C Program to find out the sum of first n n... >>
<< C Program to find largest number among three numbe...