Advertisement
Gireada

Varianta 6 Subiectul 1 ex2

Sep 23rd, 2013
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream.h>
  2. #include <conio.h>
  3.  
  4. int main()
  5. {
  6.     unsigned a,b,nr,i,x,c;
  7.     cin>>a;cin>>b;
  8.     nr=0;
  9.     for(i=a; i<=b; i++)
  10.     {
  11.         x=i;
  12.         c=x%10;
  13.         while(x!=0 && x%10==c)
  14.         {
  15.             x=x/10;
  16.         }
  17.         if(x == 0)
  18.         {
  19.              nr++;
  20.         }
  21.     }
  22.     cout<<nr;
  23.     getch();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement