Advertisement
STANAANDREY

ss

Dec 7th, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6.  
  7. {
  8.  
  9.  int a,b,nrpali=0,s=0,nr,aux,ca;
  10.   float ma;
  11.   do {
  12.         cout<<"a=";
  13.  cin>>a;
  14.  cout<<"b=";
  15.  cin>>b;
  16.  aux=a;
  17. // ca=a;
  18.  do
  19.  {
  20.      nr=0;
  21.      ca=aux;
  22.      do
  23.      {
  24.       nr=nr*10+ca%10;
  25.       ca/=10;
  26.      } while (ca!=0);
  27.      if (aux==nr)
  28.      {
  29.          s+=nr;
  30.          nrpali++;
  31.      }
  32.      aux++;
  33.  } while (aux<=b);
  34.  
  35.  ma=(float)s/(float)nrpali;
  36.  cout<<"ma="<<ma;
  37.   }while (a>b);
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement