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