link
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;
int main()
{
char str[1050];
long long i ,j,len,sum1,sum2,sum;
while(scanf("%s",str)==1)
{
len=strlen(str);
if(str[0]=='0'&&len==1) break;
sum1=0;sum2=0;
for(i=0;i<len;i+=2)
{
sum1+=(str[i]-'0');
}
for(j=1;j<len;j+=2)
{
sum2+=(str[j]-'0');
}
sum=(sum1-sum2);
if(sum%11==0)
{
printf("%s is a multiple of 11.\n",str);
}
else
{
printf("%s is not a multiple of 11.\n",str);
}
}
return 0;
}
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;
int main()
{
char str[1050];
long long i ,j,len,sum1,sum2,sum;
while(scanf("%s",str)==1)
{
len=strlen(str);
if(str[0]=='0'&&len==1) break;
sum1=0;sum2=0;
for(i=0;i<len;i+=2)
{
sum1+=(str[i]-'0');
}
for(j=1;j<len;j+=2)
{
sum2+=(str[j]-'0');
}
sum=(sum1-sum2);
if(sum%11==0)
{
printf("%s is a multiple of 11.\n",str);
}
else
{
printf("%s is not a multiple of 11.\n",str);
}
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন