Monday, 21 January 2013

sum and average using array in c++


#include <iostream.h>
#include <conio.h>
void main()
{
int arry[10],c;
float ave;
for(c=0;c<10;c++)
{cout<<"ENTER TEN INTEGER"<<endl;
cin>>arry[c];}
for(c=0;c<10;c++)
{cout<<" "<<arry[c]<<""<<endl;}
float sum=0;
for(c=0;c<10;c++)
{sum=sum+arry[c];
ave=sum/10;}
cout<<"SUM="<<sum<<endl;
cout<<"AVE="<<ave<<endl;

getch();
}

0 comments:

Post a Comment