Write a program that reads integers, finds the largest and counts the occurrences. Assume that when the user enters it ends the sequence.

Example :
3 5 5 5 0
Largest : 5
Occurrences : 3

I can't use arrays .
I know I'm suppose to use loops but I can't just figure it out . I would greatly appreciate any help !

C programming

Recommended Answers

All 2 Replies

If you will show us the code thta you have tried, then we may be able to help.

You need to do some plan work...
First, how many digit is the user allow to enter?
Use a sorting method to check which one is greater(greatest)
let say a, b, c d e f,
If a>b, then compare (a) with c etc...
The greater one will retain the subject of comparison ...
Also check, if new value is equal to the greatest value, then the older value continue, then you define a variable to hold the occurence count.... Hope I have help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.