Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ASSIGNMENT#3 . Compatibility Mode . Saved to this PC References Mailings Review

ID: 3698686 • Letter: A

Question

ASSIGNMENT#3 . Compatibility Mode . Saved to this PC References Mailings Review View Help Tell me what you want to do 1 Normal 1 No Spac. Heading 1 Heading 2 Styles Paragraph ASSIGNMENT#3 Student Name: Class Date: Write a stt program that reads a set of integers, and computes the following: -average maximum value minimum value - Sum of the numbers that are divisible by 5 Your program will continue reading and computing the integers while the integer entered is not zero (O is the integer that stops the loop). Activa 11 t

Explanation / Answer

for finding average you need two variable sum and count, we will have 3 more variable max, min and sum of integer divisible by 5. now for the condition of keep looping till we encounter 0, do while loop can be used. so you can write program as :

int main() {

int i;

cin >> i;

int sum = 0;

int max = INT_MIN;

int min = INT_MAX;

int count = 0;

int sum5 = 0;

do {

count = count + 1;

sum = sum+i;

if (i>max) {

max = i;

}

if(i<min) {

min = i;

}

if(i%5 == 0) {

sum5 = sum5 +i;

}

cin >> i;

}while (i!=0);

int average = sum/count;

cout<<average;

cout<<max;

cout<<min;

cout<<sum5;

}

rest of formatting and other optimization changes and comments, you can add them accordingly. Main logic is like this.