Răspuns:
1
#include<iostream>
using namespace std;
int main()
{
int n, v[1002], s=0, s1=0, c=0, i;
cin>>n;
for(i=1; i<=n; i++)
cin>>v[i];
while(v[1]!=0)
{
s=s+v[1]%10;
v[1]=v[1]/10;
}
for(i=2; i<=n; i++)
{
s1=0;
while(v[i]!=0)
{
s1=s1+v[i]%10;
v[i]=v[i]/10;
}
if(s==s1)
c++;
}
cout<<c;
}
2
#include<iostream>
using namespace std;
int main()
{
int n, maxi=-1, v[1002], i;
cin>>n;
for(i=1; i<=n; i++)
{
cin>>v[i];
}
for(i=1; i<=n; i++)
{
if(v[i]>maxi)
maxi=v[i];
}
cout<<maxi;
}
Explicație: