#include <iostream>
using namespace std;
int main()
{
int a,k=0,sum=0;
cin>>a;
while(a!=0)
if(a>99 && a<1000)
sum+=a;
k++;
}
if(k==0)
cout<<"NO"<<endl;
else
cout<<sum*1.0/k<<endl;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
#include <iostream>
using namespace std;
int main()
{
int a,k=0,sum=0;
cin>>a;
while(a!=0)
{
if(a>99 && a<1000)
{
sum+=a;
k++;
}
cin>>a;
}
if(k==0)
cout<<"NO"<<endl;
else
cout<<sum*1.0/k<<endl;
return 0;
}