76 802
Assignments Done
Successfully Done
In June 2019

Answer to Question #1165 in C++ for dula

Question #1165
Enter a number and find how many times the smallest digit occurred?
Expert's answer
#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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions