Advertisement
Cucura_Georgiana

Varianta 2017, Subiect 3

Nov 22nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. (2017, 8 iunie, sesiunea specială)
  2.  
  3. 3.  #include<iostream>
  4. using namespace std;
  5. int egale(int a)
  6. {
  7.     int u=a%10;
  8.     while(a!=0)
  9.     {
  10.         if(a%10!=u)
  11.         {
  12.             return 0;
  13.         }
  14.         a=a/10;
  15.     }
  16.     return 1;
  17. }
  18. void identice(int a, int b)
  19. {
  20.     int i, ok=0;
  21.     for(i=a; i<=b; i++)
  22.     {
  23.         if(egale(i)==1)
  24.         {
  25.             cout<<i<<" ";
  26.             ok=1;
  27.         }
  28.     }
  29.     if(ok==0)
  30.     {
  31.         cout<<"nu exista";
  32.     }
  33. }
  34. int main()
  35. {
  36.     int a, b;
  37.     cin>>a>>b;
  38.     identice(a, b);
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement