Answer to Question #1165 in C++ for dula

Question #1165
Enter a number and find how many times the smallest digit occurred?
1
Expert's answer
2010-12-20T16:17:00-0500
#include <iostream>using namespace std;int main(){ int n; cout<<"Enter n..."<<endl; cin>>n; int counter=1; int k=n,m=0; n=n/10; while (n!=0) { m=n; n=n/10; if (m<k) { k=m; counter=1; } else if(m==k) counter++; } cout<<counter<<endl; system("pause");}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS