Răspuns:
Explicație:
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin >> a >> b;
int num, sc;
for (num=a; num<=b; num++) {
cout << num << " ";
}
cout << endl;
for (num=a; num<=b; num++) {
sc=0;
int m=num;
while (m) {
sc=sc+m%10;
m=m/10;
}
cout << sc << " ";
}
cout << endl;
float ma=0, m7=0;
int ni=0, n7=0;
for (num=a; num<=b; num++) {
if (num%2==1) {
ma=ma+num;
ni=ni+1;
}
if (num%7==0) {
m7=m7+num;
n7=n7+1;
}
}
ma=1.0*ma/ni;
cout << ma << endl;
cout << m7/n7 << endl;
return 0;
}