Răspunsuri

Cel mai inteligent răspuns!
2014-04-23T15:57:35+03:00
#include<iostream>
using namespace std;
int main(){
int x[10],n,i,z,s,y[10];
cout<<"n=";cin>>n;
for(i=1;i<=n;i++){
cout<<"x["<<i<<"]=";
cin>>x[i];

cout<<endl;
}
for(i=1;i<=n;i++){
z=x[i];
s=0;
while(z!=0){
s=s+z%10;

z=z/10;

}

y[i]=x[i]%s;
}
for(i=1;i<=n;i++)
cout<<y[i]<<" ";
return 0; 
 }
2 5 2
2014-04-24T00:44:43+03:00
#include<iostream>
using namespace std;
int main(){
int x[10],n,i,z,s,y[10];
cout<<"n=";cin>>n;
for(i=1;i<=n;i++){
cout<<"x["<<i<<"]=";
cin>>x[i];

cout<<endl;
}
for(i=1;i<=n;i++){
z=x[i];
s=0;
while(z!=0){
s=s+z%10;

z=z/10;

}

y[i]=x[i]%s;
}
for(i=1;i<=n;i++)
cout<<y[i]<<" ";
return 0; 
 }
Sper ca te-am ajutat. Succes !