How can I write a c++ program to print the summation of even digit for any read number in the keyboard ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I write a c++ program to print the summation of even digit for any read number in the keyboard ??

18th Mar 2017, 7:25 PM
Khitam Aloudat
Khitam Aloudat - avatar
2 Answers
+ 1
https://youtu.be/cNze5ZAlp2w SEE C PROGRAM SUMMATION
2nd Aug 2017, 1:33 PM
Jamiul Alam Rejon
Jamiul Alam Rejon - avatar
0
#include <iostream> using namespace std; int main() { int n,sum=0; cout<<"Enter a number:"; cin>>n; cout<<n; while(n!=0) { if (n%2==0) sum=sum+(n%10); n=n/10; } cout<<endl<<"sum of digits of number:"<<sum; return 0; }
18th Mar 2017, 10:50 PM
Khitam Aloudat
Khitam Aloudat - avatar