int addition (int a, int b,int c,int d, int e)
{
int r;
r=a+b+c+d+e;
return (r);
}
int main ()
{
int z,y,x,w,v,u,o;
cout<<"\n\nEnter Your 5 grades: \n";
cin>>u>>v>>w>>x>>y;
z = addition (u,v,w,x,y);
o=z/5;
cout<<"\n\nYour Average is : "<<o<<"\n";
if (o>=75){
cout<<"\nCongratulations\nYou Passed the midterm";}
else{
cout<<"\nYou Failed sorry\n";}
system("pause");
return 0;
}
and this
#include <iostream>
using namespace std;
int main()
{
const int finals=5;
int i,ga, g[finals];
for(i=0;i<finals;i++)
{
cout<<"Enter a Grade: ";
cin>>g[i];
int ga;
ga=g[i]+ga;
}
int ave;
ave=ga/5;
cout<<"\n\nYour Average is : "<<ave<<"\n";
if (ave>=75){
cout<<"\nCongratulations\nYou Passed the Finals\n";}
else{
cout<<"\nYou Failed sorry\n";}
system("pause");
return 0;
}
And what is your problem? You never said what we're looking for.
Word of advice, use code tags when posting code, and name your variables something useful. I don't understand why no one wants to name variables so people actually know what they're used for
If you can tell us what is wrong, and post it inside of the code tags (when typing, highlight ur text and click the <> button to the side) we can help a lot more than just looking