Why is the output of average not coming in decimals.
#include
using namespace std;
int main() {
int n,num,i,sum=0;
float avg;
cin>>n;
i=1 ;
while(i<=n){
cin>>num;
sum=sum+num;
i=i+1;
}
cout<<"The sum is "<<sum<<endl;
avg = float(sum/n);
cout<<"The average is "<<avg<<endl;
return 0;
}