CPE 6. You can say 11
user_3763047219
c_cpp
3 years ago
670 B
9
Indexable
# include <iostream>
# include <string>
# include <cstdlib>
using namespace std;
int main(){
string num;
while(cin>>num){
int N=num.length();
int even=0,odd=0;
if(num!="0"){
for(int i=0;i<N;i++){
if(i%2==0){
even=even+(num[i]-'0');
}
else{
odd=odd+(num[i]-'0');
}
}
if((even-odd)%11==0){
cout<<num<<" is a multiple of 11."<<endl;
}
else{
cout<<num<<" is not a multiple of 11."<<endl;
}
}
}
}
Editor is loading...