You are viewing a single comment's thread. Return to all comments →
class Student{ public : int score[5] , sum=0; void input(){ for(int i=0;i<5;i++){ cin>>score[i]; } } int calculateTotalScore(){ for(int i=0;i<5;i++){ sum+=score[i]; } return sum; } };
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Classes and Objects
You are viewing a single comment's thread. Return to all comments →
class Student{ public : int score[5] , sum=0; void input(){ for(int i=0;i<5;i++){ cin>>score[i]; } } int calculateTotalScore(){ for(int i=0;i<5;i++){ sum+=score[i]; } return sum; } };