#include <iostream>
using namespace std;
float findmax(float array[],int size);
int main()
{
float marks1,marks2;
float subjectcodes[5],avgmarks[5];
for(int i=0;i<5;i++)
{
cout<<"Enter subject code : ";
cin>>subjectcodes[i];
cout<<"Enter marks 1 : ";
cin>>marks1;
cout<<"Enter marks 2 : ";
cin>>marks2;
avgmarks[i]=(marks1+marks2)/2.0;
}
float max=findmax(avgmarks,5);
cout<<"maximum avg is = "<<max<<endl;
return 0;
}
float findmax(float array[],int size)
{
float max=0;
for(int j=0;j<size;j++)
{
if(max<array[j])
{
max=array[j];
}
else
{
max=max;
}
}
return max;
}
using namespace std;
float findmax(float array[],int size);
int main()
{
float marks1,marks2;
float subjectcodes[5],avgmarks[5];
for(int i=0;i<5;i++)
{
cout<<"Enter subject code : ";
cin>>subjectcodes[i];
cout<<"Enter marks 1 : ";
cin>>marks1;
cout<<"Enter marks 2 : ";
cin>>marks2;
avgmarks[i]=(marks1+marks2)/2.0;
}
float max=findmax(avgmarks,5);
cout<<"maximum avg is = "<<max<<endl;
return 0;
}
float findmax(float array[],int size)
{
float max=0;
for(int j=0;j<size;j++)
{
if(max<array[j])
{
max=array[j];
}
else
{
max=max;
}
}
return max;
}
0 comments:
Post a Comment