#include <iostream>
using namespace std;
int main()
{ int v[30],i,n,c,r,s;
cout<<"n=";cin>>n;
for(i=1;i<=n;i++)
{
cout<<"v["<<i<<"]=";cin>>v[i];
}
for(i=1;i<=n;i++)
{ r=v[i];
s=0;
while(r!=0)
{
c=r;
s=s+c;
r=r/10;
}
if(s==v[i+1])
cout<<"("<<v[i]<<","<<v[i+1]<<")"<<endl;
i=i+1;
}
return 0;
}
Niciun comentariu:
Trimiteți un comentariu