Code:
#include <iostream>
using namespace std;
int main()
{
int broj1,broj2;
cout<<"unesi prvi trocifren broj "<<endl;
cin>>broj1;
cout<<"unesi drugi trocifren broj "<<endl;
cin>>broj2;
for (int i=100; i<1000; i++)
{
int j,d,s,j1,d1,s1;
j=broj1%10;
broj1/=10;
d=broj1%10;
broj1/=10;
s=broj1%10;
j1=broj2%10;
broj2/=10;
d1=broj2%10;
broj2/=10;
s1=broj2%10;
}
int z1,z2;
z1=j+d+s; //ovde stavlja gresku
z2=j1+d1+s1;
if (z1>z2)
{
cout<<"zbri cifara prvog broja je veci"<<endl;
cout<< z1 <<endl;
}
else
{
cout<<"zbir cifara drugog broja je veci"<<endl;
cout<< z2 <<endl;
}
system("pause");
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int broj1,broj2;
cout<<"unesi prvi trocifren broj "<<endl;
cin>>broj1;
cout<<"unesi drugi trocifren broj "<<endl;
cin>>broj2;
for (int i=100; i<1000; i++)
{
int j,d,s,j1,d1,s1;
j=broj1%10;
broj1/=10;
d=broj1%10;
broj1/=10;
s=broj1%10;
j1=broj2%10;
broj2/=10;
d1=broj2%10;
broj2/=10;
s1=broj2%10;
}
int z1,z2;
z1=j+d+s; //ovde stavlja gresku
z2=j1+d1+s1;
if (z1>z2)
{
cout<<"zbri cifara prvog broja je veci"<<endl;
cout<< z1 <<endl;
}
else
{
cout<<"zbir cifara drugog broja je veci"<<endl;
cout<< z2 <<endl;
}
system("pause");
return 0;
}