A C++ teacher wants to find how many students he has in his classroom, He did th
ID: 3651840 • Letter: A
Question
A C++ teacher wants to find how many students he has in his classroom, He did the following to discover the number: When he forms groups of 4, he is left with one group of 3 students When forming groups of 3, he is left with one group of 2 students Finally when forming groups of 5, no odd group is left. All groups have five students. Write a program to help the teacher find how many students in his classroom. Loops, again! Write a while loop, that adds 5 to n for as long as n is smaller than 15 What would the value of n be at the end of the loop if n = 3 before the loop? What would the value of n be at the end of the loop if n = 21 before the loop?Explanation / Answer
#include using namespace std; int main(){ int student=0; for(int num=1;num>0;num++){ if((num%4==3)&&(num%3==2)&&(num%5==0)){ student=num; num=-100; } } coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.