#include
#include
void main()
{
int n,i,temp=0,a=1;
printf("Enter the Number = ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%2==0)
{
temp=temp+i;
}
else
{
a=a*i;
}
}
printf("Sum of Even number = %d\n",temp);
printf("Product of Odd number = %d\n",a);
getch();
}
----------------------------------------------------------------------------------
OUTPUT : -
#include
void main()
{
int n,i,temp=0,a=1;
printf("Enter the Number = ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%2==0)
{
temp=temp+i;
}
else
{
a=a*i;
}
}
printf("Sum of Even number = %d\n",temp);
printf("Product of Odd number = %d\n",a);
getch();
}
----------------------------------------------------------------------------------
OUTPUT : -