- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Maximum students to pass after giving bonus to everybody and not exceeding 100 marks in C++
In this tutorial, we will be discussing a program to find maximum students to pass after giving bonus to everybody and not exceeding 100 marks.
For this we will be provided with an array containing marks of N students. Our task is to get more student pass the exam (50 marks required) by giving each student the same amount of bonus marks without any student exceeding 100 marks.
Example
#include<iostream> #include<algorithm> using namespace std; int check(int n, int marks[]) { int* x = std::max_element(marks,marks+5); int bonus = 100-(int)(*x); int c = 0; for(int i=0; i<n;i++) { if(marks[i] + bonus >= 50) c += 1; } return c; } int main() { int n = 5; int marks[] = {0, 21, 83, 45, 64}; cout<<check(n, marks)<<endl; return 0; }
Output
3
- Related Articles
- Maximum students to pass after giving bonus to everybody and not exceeding 100 marks in C++ Program
- In order to pass in the exam, one must score 40% marks. If Manu scored 100 marks and failed by 20 marks. Find the maximum marks.
- In an examination , a student has to score 40%marks to pass. He gets 40 marks and fail by 40 marks. Find the maximum number of marks
- C++ program to find maximum distance between two rival students after x swaps
- C program to find marks of students for boys or girls
- The marks obtained by 10 students in a test are $60,72,70,64,56,52,71,54,62,59$. Find the mean marks of the students. Find the mean marks of the students if 6 extra marks are given to each student.
- In a Mathematics test, the following marks were obtained by 40 students. Arrange these marks in a table using tally marks.(a) Find how many students obtained marks equal to or more than ( 7 . )(b) How many students obtained marks below 4?"
- C++ code to find position of students after coding contest
- Given below is the bar graph indicating the marks obtained out of 50 in mathematics paper by 100 students. Read the bar graph and answer the following questions:It is decided to distribute work books on mathematics to the students obtaining less than 20 marks
- In a mathematics test given to 15 students, the following marks (out of 100 ) are recorded:$41,39,48,52,46,62,54,40,96,52,98,40,42,52,60$Find the mean, median and mode of this data.
- C++ code to count copy operations without exceeding k
- The marks $(out of 100)$ obtained by a group of students in a science test are 85, 76, 90, 85, 39, 48, 56, 95, 81 and 75. Find the:$(i)$. Highest and the lowest marks obtained by the students.$(ii)$. Range of the marks obtained.$(iii)$. Mean marks obtained by the group.
- Finding average marks of students for different subjects and display only the highest average marks in MySQL
- The probability of scoring 70 marks in a 100 marks test is _______
- Program to find maximum average pass ratio in Python

Advertisements