56. WAP to add all the even and multiply all the odd digits of given integer.
#include<stdio.h>
void
main()
{
int number,temp,add=0,mul=1;
printf("WAP to add all the even
and multiply all the odd digits of given integer\n");
printf("Enter the number :
");
scanf("%d",&number);
for(;number;number=number/10)
{
temp=number%10;
if(temp%2==0)
add=add+temp;
else
mul=mul*temp;
}
printf("Addition of Even Numbers :
%d\n",add);
printf("Multiplication of Odd
Numbers : %d\n",mul);
}
Comments
Post a Comment