Facebook
From Bitty Mousedeer, 6 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 225
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int x, c, d, b, z, a=10, i=1;
  5. cout<<"Wpisz x"<<endl;
  6. cin>>x;
  7. if (x==0){
  8.     cout<<"Blad!"<<endl;
  9. }
  10. else if(x==1){
  11.     do{
  12.         cout<<x<<endl;
  13.         x++;
  14.     }
  15.         while(x<10);
  16.         cout<<"Jest tyle takich liczb "<< x-1 <<endl;
  17. }
  18. else{
  19. z=x-1;
  20. while(z!=i){
  21.         a=a*10;
  22.         i++;
  23. };
  24.  
  25. b=10*a-1;
  26. c=a;
  27. d=b;
  28. while(b>=a){
  29.         cout<<b<<endl;
  30.         b--;
  31.         }
  32. cout<<"Jest tyle takich liczb: "<< d-c+1 <<endl;
  33. }
  34. return 0;
  35. }
  36.