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