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