VUsolutions Transferred to AchiKhasi.com

From December 2011, this blog www.VUsolutions.blogspot.com is transferred to http://achikhasi.com/vu/ . So, you may visit http://achikhasi.com/vu/ for latest study related help.

Back to home VUsolutions

VUsolutions Fans Club [join us for MORE solutions]

VUsolutions on Facebook

cs201 assignemnt no. 2 solution

Wednesday, May 02, 2012 Edit This
#include<iostream.h>
#include<conio.h>
float avg(int [],int);
float low(int [],int);
float high(int [],int);

int main()
{
int n;
cout<<"Enter the number of consecutive days to read their temperature";
cin>>n;
cout<<endl;

int arr[10];
float l,h,a;
for(int i=0;i<n;i++)
{
cout<<"Enter the temperature for day "<<i+1<<" : ";
cin>>arr[i];
cout<<endl;
}
cout<<endl;
a=avg(arr,n);
cout<<"The Average Temperature is "<<a<<endl;
h=high(arr,n);
cout<<"The Highest temperature is "<<h<<endl;
l=low(arr,n);
cout<<"The Lowest temperature is "<<l;


getch();
}

float avg(int arr[],int n)
{
float sum=0.0,a;
for(int i=0;i<n;i++)
{
sum=sum+arr[i];

}
a=sum/5.0;
return (a);
}

float low(int arr[],int n)
{
float l=100.0;
for(int i=0;i<n;i++)
{
if(arr[i]<l)
l=arr[i];
}

return (l);
}
float high(int arr[],int n)
{
float h=0.0;
for(int i=0;i<n;i++)
{
if(arr[i]>h)
h=arr[i];


}

return (h);
}

Back to home VUsolutions

Shaadi.com: Just create ur account & find ur partner or EARN money, its reall & EASY

VUsolutions Followers (Join NOW and Get Extra Benefits)

Install LATEST toolbar having lot of features - GET solutions on Desktop

toolbar powered by Conduit
Caliplus 300x250 NoFlam VitoLiv 468x60 GlucoLo