Q. Write a C program to read the internal test marks of 25 students in a class and show the number of students who have scored more than 50% in the test.
Ans.
/*We assume that maximum marks in internal test is 500. */
#include<stdio.h>
#include<stdio.h>
#include<conio.h>
#define SIZE 5
#define SIZE 5
int main()
{
int arr[SIZE];
int i,j,max=0,min=0;
for(i=1; i<=SIZE; i++)
{
printf("Enter %d student marks : ",i);
scanf("%d",&arr[i]);
}
for(i=1; i<=SIZE; i++)
{
if(arr[i]/5 > 50)
{
max++;
printf("\nMarks which scored more than 50%% is %d",arr[i]);
}
else
{
min++;
printf("\nMarks which scored less than 50%% is %d",arr[i]);
}
}
printf("\n");
printf("\n");
printf("\nTotal number of students who scored more than 50%% = %d",max);
printf("\nTotal number of students who scored less than 50%% = %d",min);
getch();
return 0;
getch();
return 0;
}
Output of the above program :
Enter 1 student marks : 450
Enter 2 student marks : 152
Enter 3 student marks : 266
Enter 4 student marks : 65
Enter 5 student marks : 123
Marks which scored more than 50% is 450
Marks which scored less than 50% is 152
Marks which scored more than 50% is 266
Marks which scored less than 50% is 65
Marks which scored less than 50% is 123
Marks which scored less than 50% is 152
Marks which scored more than 50% is 266
Marks which scored less than 50% is 65
Marks which scored less than 50% is 123
Total number of students who scored more than 50% = 2
Total number of students who scored less than 50% = 3
this site is really very helpfull.
ReplyDeletetu si gr8 ho ji :)