Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a,b,nrpali=0,s=0,nr,aux,ca;
- float ma;
- do {
- cout<<"a=";
- cin>>a;
- cout<<"b=";
- cin>>b;
- aux=a;
- // ca=a;
- do
- {
- nr=0;
- ca=aux;
- do
- {
- nr=nr*10+ca%10;
- ca/=10;
- } while (ca!=0);
- if (aux==nr)
- {
- s+=nr;
- nrpali++;
- }
- aux++;
- } while (aux<=b);
- ma=(float)s/(float)nrpali;
- cout<<"ma="<<ma;
- }while (a>b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement