Write a program to print the sum of even position & product of odd position digit of any inputted Number

#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 : -

Previous Post
Next Post

Related Posts: