0

I want to count 9 b/w 100 to 1000 in c++ lng plz hlp me

2nd Oct 2017, 4:38 AM
Rupam
5 Antworten
+ 9
@Rupam according to me, the logic has to be like written below 👇👇👇👇 void main () { int dig, count =0,q,n; cout <<"enter the digit you want to count between 100 and 1000"; cin>>dig; for (n=100;n<=1000;n++) { while(n) { q=n%10; if(q==dig) count++; n=n/10; } } cout <<count; getch(); } please correct me if I am wrong anywhere..... suggestions are most welcome. 😀😀😀
2nd Oct 2017, 8:57 AM
Swati Tiwari
+ 1
Like This? #include <iostream> using namespace std; int main() { for(int x=100; x<1000; x+=9) { cout << x << endl; } return 0; } https://code.sololearn.com/csYdU6qxQUjG/?ref=app
2nd Oct 2017, 5:19 AM
Jeff Shipton
Jeff Shipton - avatar
+ 1
https://code.sololearn.com/cP1xajslpO3H/?ref=app This is your answer, I hope you understand it simply!
2nd Oct 2017, 9:14 AM
Shubham Gupta
Shubham Gupta - avatar
0
no i dont want this... i want to know how many nine digts b/w 100 to 1000..
2nd Oct 2017, 5:25 AM
Rupam
2nd Oct 2017, 2:46 PM
SACHIN BARUA
SACHIN BARUA - avatar