Write a program that reads integers, finds the smallest of them and counts its o
ID: 3632253 • Letter: W
Question
Write a program that reads integers, finds the smallest of them and counts its occurences.
Assume that the input ends with 0. (Hint: Maintain two variables, min and count. Min stores the
current min number, and count stores its occurences. Initially, assign the first number to min and 1
to count. Compare each subsequent number with min. If the number is less than min, assign it to
min and reset count to 1. If the number is equal to min, increment count by 1.)
Ex: Enter integer numbers: 6 2 5 2 2 3 0
The smallest number is 2, its occurrence number is 3.
Explanation / Answer
#include int main() { int A[10],min=9999,count=0,i;//Change the size of Array according to you and //initialized min with maximum possible value in your array for(i=0;iRelated 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.