Facebook
From Gentle Owl, 6 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 265
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int x, b, z, a=10, i=1;
  5. cout<<"Wpisz x"<<endl;
  6. cin>>x;
  7. if (x==0){
  8.     cout<<"Blad!"<<endl;
  9. };
  10. 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. cout<<"Jest tyle takich liczb "<< b-a+1 <<endl;
  27. while(b>=a){
  28.         cout<<b<<endl;
  29.         b--;
  30.         }
  31.  
  32. }
  33. return 0;
  34. }
  35.