Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, x, i, c, cp, cf, s=0, v;
- cout<<"n="; cin>>n;
- for(i=1; i<=n; i++)
- {
- cin>>x;
- v=x;
- cp=x%10;
- while(x!=0)
- {
- c=x%10;
- x=x/10;
- }
- cf=c;
- if(cp==cf)
- s=s+v;
- }
- cout<<s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment