Răspuns :
#include <iostream>
using namespace std;
int main ()
{
int v[100], n, i, cmax, k=0, x;
cout<<"n="; cin>>n;
for (i=1; i<=n; i++)
{
cout<< "v [" << i << "] ="; cin>>v[i];
cmax=v[i]%10; v[i]=v[i]/10;
while (v[i]!=0)
{ if (cmax<v[i]%10)
cmax=v[i]%10;
if (cmax%2!=0)
k++;
cout<<" "<<cmax<<endl;
v[i]=v[i]/10;}
}
cout<<" b) "<<k;
return 0;
}
Răspuns:
Raspuns
Explicație:
#include <iostream>
using namespace std;
int main()
{
int v[100];
int n,i,maxi,cnt=0;
cin>>n;
for(i=1;i<=n;i++)
cin>>v[i];
for(i=1;i<=n;i++)
{
maxi=v[i]%10;
v[i]/=10;
while(v[i]!=0)
{
if(maxi<v[i]%10)
maxi=v[i]%10;
v[i]/=10;
}
if(maxi%2==1)
cnt++;
cout<<maxi<<' ';
}
cout<<endl<<cnt;
return 0;
}