long long power(int p)//3,4
{
long long sum = 1;
for (int i = 1; i <= p; i++)
{
sum *= 10;
}
return sum;
}
int main()
{
system("cls");
long long n;
long long m[30];
long long sum = 0;
cout << "Enter Input : ";
cin >> n;
int k = 12;
for (int i = 0; i<k; i++)
{
m[i] = n % (power(k - i)) / (power(k - 1 - i));
}
for (int i = 0; i<k; i++)
{
sum += m[i] * (k - i + 1);
}
cout << endl;
long long mod = sum % 11;
mod = 11 - mod;
cout << n << " " << mod << " ";
return 0;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น