Hi.! I'm a beginner .. I encountered a question to find the smallest non-zero digit in a number.. This is my work till now.. I am unable to apply syntax to my logic.. Should i proceed with this and if i should please help me complete the code.. Or should i look for another logic
int n;
cin>>n;
int r = n%10;
while(n/=10)
{
r=min(n%10,r);
}
if(r!=0)
{
cout<<r;
}
else
{