Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

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

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


#include <stdio.h>


int main()

{

int n;

int i;

int sum=0,multi=1;


for (i = 1 ; i <= 10 ; i++ )

{

    printf("enter a number : ");

    scanf("%d",&n);

     

    if (n%2 == 0)

    { 

        sum=n+sum;

    }

    else 

    {

        multi=multi*n;

    }

}

printf("sum = %d and product = %d\n",sum,multi);


return 0;

}

 

Post a Comment

0 Comments