Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
277 B
3
Indexable
Never
#include <iostream>
using namespace std;
int main()
{
int num,n,count=0;
cout<<" enter number ";
cin>>num;
cout<<"enter digit ";
cin>>n;
if(num>0)
{
while(num!=0)
{
if(num%10==n)
{
count++;
}
num=num/10;
}
cout<<"There are "<<count<<" times the digit";
}
}