www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS201 Asig 2 Sol

Assalam-o-Alikum

ye solution sahi ha yar?

agar sahi hai tau asaan tareqe se bana de koi :P

Views: 600

Attachments:

### Replies to This Discussion

Aslam-e-alaikum bhai is mein kya masla mein ne ik are upload with comment ho sakta hai is bar ap ko smajh per jaey.

sath mein ye idea soulution tha. asli wali mein ne abhi upload ki hai.changes zaror karna.

#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;
coutendl;

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];
coutendl;
}
coutendl;
a=avg(arr,n);
cout"The Average Temperature is "aendl;
h=high(arr,n);
cout"The Highest temperature is "hendl;
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);
}

1

2

3

4

5

## Latest Activity

attiqa joined + M.Tariq Malik's group

### MTH641 Functional Analysis

4 minutes ago
attiqa joined + M.Tariq Malik's group

### MTH632 Complex Analysis and Differential Geometry

5 minutes ago
Ehrish Gul updated their profile
10 minutes ago
attiqa joined +Roha's group

### MTH631 - Real Analysis II

10 minutes ago
attiqa joined + M.Tariq Malik's group

### STA642 Probability Distributions

11 minutes ago
attiqa joined + M.Tariq Malik's group

### MTH601 Operations Research

12 minutes ago
13 minutes ago
15 minutes ago

© 2021   Created by + M.Tariq Malik.   Powered by