1.
Find the sum, avg, maximum, minimum, min=a[0];
position of the array?
for(i=1;i<5;i++)
#include<iostream>
{
using namespace std;
if(a[i]<min)
int main()
{
{
min=a[i];
int i,total,position,avg;
}
int max,min;
}
total=0;
cout<<"the minimum is "<<min<<endl;
position=0;
return 0;
int a[5];
}
for(i=0;i<5;i++)
2.Find the total days from the start of the year
{ to this day.
cout<<"enter a["<<i<<"]="; #include<iostream>
cin>>a[i]; using namespace std;
} int main()
for(i=0;i<5;i++) {
{ int day,month,dayspermonth,total;
total+=a[i]; int daypermonth[12]={31,28,31,30,31,30,
} 31,31,30,31,30,31 };
cout<<"total="<<total<<endl; cout<<"Enter month";
cout<<"average="<<total/5<<endl; cin>>month;
max=a[0]; cout<<"Enter day";
for(i=1;i<5;i++) cin>>day;
{ total=day;
if(a[i]>max) for(int i=0;i<month-1;i++)
{ {
max=a[i]; total+=daypermonth[i];
position=i; }
} cout<<"Total="<<total;
} return 0;
cout<<"the maximum is "<<max<<endl; }
cout<<"the maximum position is
"<<position<<endl;