You can say 11
user_6817964
c_cpp
3 years ago
609 B
7
Indexable
#include <iostream>
#include <string>
using namespace std;
main(){
string x;
while(cin >> x){
if(x == "0")
break;
cout << x;
int a = 0, b = 0;
for(int i = 0; i < x.length(); i++){
if(i % 2 == 0){
a = a + (int)x[i] - 48;
}
else{
b = b + (int)x[i] - 48;
}
}
if((a-b)%11 == 0){
cout << " is a multiple of 11." << endl;
}
else{
cout << " is not a multiple of 11." << endl;
}
}
}Editor is loading...