HOME

Friday, September 4, 2015

COUNT TOTAL NO. OF DIGIT AND EVEN DIGIT PRESENT IN NUMBER

#include<iostream>
using namespace std;
int main()
{
    int num,rem,c=0,dig=0;
    cout<<"Enter the number"<<endl;
cin>>num;
while(num>0)
{
    rem=num%10;
    c++;
    if(rem%2==0)
    {
        dig++;
    }
    num/=10;
}
cout<<"number of digit present is "<<c<<endl;
cout<<"number of even digit present is "<<dig<<endl;
return 0;
}

No comments:

Post a Comment