Preview:
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
double avg;
int num,sum=0,cont; 

do{
    cout<<"input values"<<endl;
     cin>>num;

    sum += num;
    cont += 1;
                     }
  
while(num != 0);

avg = (static_cast<double>(sum))/(cont-1);
cout<<avg<<endl;









downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter