Answer to Question #1165 in C++ for dula
Enter a number and find how many times the smallest digit occurred?
1
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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment