In: Computer Science
Source code of the program and its working are given below.Comments are also given along with the code for better understanding.Screen shot of the code and output are also attached.If find any difficulty, feel free to ask in comment section. Please do upvote the answer.Thank you.
Working of the code
Source code
#include<stdio.h>
int main()
{
//creating a two dimensional array of size 10 X
3
int scores[10][3],i,j;
//Entering 10 student's marks
for(i=0;i<10;i++)
{
printf("Enter the scores of student
%d ",i+1);
//for each student,marks of three
courses added
for(j=0;j<3;j++)
//reading
scores
scanf("%d",&scores[i][j]);
}
//10 point bonus is added to course 2 for all
students
printf("\nAdding 10 bonus to course 2........");
//accessing each student
for(i=0;i<10;i++)
{
//adding 10 points to second
course(ie index 1)
scores[i][1]=scores[i][1]+10;
//checking if score exceeds 100 if
yes set score to 100
if(scores[i][1]>100)
scores[i][1]=100;
}
printf("\nScores of the students after adding
bonus...");
//printing scores of each student after adding bonus
point
for(i=0;i<10;i++)
{
printf("\n\nScores of student
%d",i+1);
for(j=0;j<3;j++)
printf("\nCourse
%d score = %d",j+1,scores[i][j]);
}
}
Screen shot of the code
Screen shot of the output