#include <iostream>
using namespace std;
float findmin(float array[],int size);
int main()
{
int citycodes[5];
float avgtemp[5];
float mk1,mk2;
for(int i=0;i<5;i++)
{
cout<<"Enter city code : ";
cin>>citycodes[i];
cout<<"Enter tempreature reading 1 = " ;
cin>>mk1;
cout<<"Enter tempreature reading 2 = " ;
cin>>mk2;
avgtemp[i]=(mk1+mk2)/2.0;
}
float min=findmin(avgtemp,5);
cout<<"Minimum average tempreature is = "<<min<<endl;
for(int a=0;a<5;a++)
{
if(min==avgtemp[a])
cout<<"Minimum tempreature city code is = "<<citycodes[a]<<endl;
}
return 0;
}
float findmin(float array[],int size)
{
float min=10000;
for(int c=0;c<size;c++)
{
if(array[c]<=min)
{
min=array[c];
}
else
{
min=min;
}
}
return min;
}
using namespace std;
float findmin(float array[],int size);
int main()
{
int citycodes[5];
float avgtemp[5];
float mk1,mk2;
for(int i=0;i<5;i++)
{
cout<<"Enter city code : ";
cin>>citycodes[i];
cout<<"Enter tempreature reading 1 = " ;
cin>>mk1;
cout<<"Enter tempreature reading 2 = " ;
cin>>mk2;
avgtemp[i]=(mk1+mk2)/2.0;
}
float min=findmin(avgtemp,5);
cout<<"Minimum average tempreature is = "<<min<<endl;
for(int a=0;a<5;a++)
{
if(min==avgtemp[a])
cout<<"Minimum tempreature city code is = "<<citycodes[a]<<endl;
}
return 0;
}
float findmin(float array[],int size)
{
float min=10000;
for(int c=0;c<size;c++)
{
if(array[c]<=min)
{
min=array[c];
}
else
{
min=min;
}
}
return min;
}
0 comments:
Post a Comment