0
How can I write a c++ program to print the summation of even digit for any read number in the keyboard ??
2 Antworten
+ 1
https://youtu.be/cNze5ZAlp2w SEE C PROGRAM SUMMATION
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;
}