Write a program in C++ to input attendance as 0 (for absent) and 1 (for present) for 25 students in 32 lectures and store it in a 2-D array. After the input, write loops for calculating and displaying the index numbers of the students who has short attendance (i.e. less than 75%).
Please enter attendance of all 25 students for given lecture (total 32 lectures):
Enter attendance of Lecture “1”
Student 1:
Student 2: and so on….
Answers
Answer:
Program to find minimum number of lectures to attend to maintain 75%
Consider the subject Data Structures for which a total number of classes held till present date is
M, and some students attend only
N out of these classes. Find the minimum number of lectures they have to attend so that their
75\% attendance is maintained.
Examples:
Input : M = 7 and N = 6
Output : 0 lectures to attend
As 7 classes held till present out of which 6 classes have been attended which is greater than
75%, so no more lectures to attend
Input : M = 9 and N = 1
Output : 23 lectures to attend
Out of 9 classes, only 1 class is attended. After 23 more classes, a total of 1+23 = 24 classes
have been attended and total number of classes held = 9+23 = 32. So 24/32 = 75%. Hence 23 is
the minimum value.