Develop a C Program to accept a number & print the multiplication result of its even digits. Example: Input: -1234 Expecte | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Develop a C Program to accept a number & print the multiplication result of its even digits. Example: Input: -1234 Expecte

Want to write the program of this

12th Jun 2021, 10:45 AM
Sarthak Rai
Sarthak Rai - avatar
4 Answers
+ 4
Sarthak Rai , , before we can help you, you should show us your attempt first. if you have not done a try by yourself upto now, please do so. Put your code in playground and link it here. thanks!
12th Jun 2021, 11:19 AM
Lothar
Lothar - avatar
+ 2
Sarthak Rai the program you shared seems to solve the problem you mentioned in question title then what's the problem ?
12th Jun 2021, 11:44 AM
Arsenic
Arsenic - avatar
0
#include<stdio.h> int main() { int num, evenProd=1, rem ,temp; printf("Enter any number: "); scanf("%d", &num); while(num>0) { rem = num%10; if(rem%2==0) evenProd = evenProd * rem ; num=num/10; } printf("\nProduct of Even Digit = %d", evenProd ); return 0; }
12th Jun 2021, 11:21 AM
Sarthak Rai
Sarthak Rai - avatar
0
I'm doing that only but if I'm using else for odd it is coming for each odd no not one for all odd
12th Jun 2021, 11:22 AM
Sarthak Rai
Sarthak Rai - avatar