1.

Write the definition of a function grace_score (int score [], int size) in C++, which should check all the elements of the array and give an increase of 5 to those scores which are less than 40.Example: if an array of seven integers is as follows:45, 35, 85, 80, 33, 27, 90After executing the function, the array content should be changed as follows:45, 40, 85, 80, 38, 32, 90

Answer»

void grace_score(int score[],int size)

{

for(int i=0;i<size;i++)

{

if(score[i]<40)

score[i]=score[i]+5;

cout<<score[i]<<" ";

}

}



Discussion

No Comment Found

Related InterviewSolutions