C++ program to find average of ten numbers

//program to find average of ten numbers enter by user
#include <iostream>
using namespace std;

 int main()
   {
      int num,sum=0,count=0,avg;
      cout<<"Enter ten numbers to find its average"<<endl;
     for(int i=0;i<10;i++)
      {
         cout<<"Enter number "<<i+1<<" : ";
         cin>>num;
         sum=sum+num;
         count++;
      }
      avg=sum/count;
      cout<<"\nAverage of ten Numbers is = "<<avg<<endl;
      return 0;
   }

No comments:

Post a Comment