🔒 Closed Pa help sa paggawa ng pseudo code.

Status
Not open for further replies.

I am nobody

Forum Guru
So ganito problem

Write a pseudo code that will ask for n number of inputs. Count the occurence of the numbers.

Ex:
una daw mag ask kung ilan ang number: 8
tapos ask the number: 2, 0, 5, 5, 2, 3, 4, 3
Output:
0:1
2:2
3:2
4:1
5:2


Patulong guys.. wala akong maisip paano
 
Code:
enter number of inputs
ask user to enter the numbers
store numbers in array

counted numbers = array
for x in length of numbers array:
    occurence = 0

    for y in length of numbers array:
        if numbers[x] == numbers[y]:
            occurence += 1

    if numbers[x] not in counted numbers:
        print(f"number '{numbers[y]}' occurence: {occurence}")
        add numbers[x] in counted numbers
 
Status
Not open for further replies.

About this Thread

  • 14
    Replies
  • 532
    Views
  • 5
    Participants
Last reply from:
I am nobody

Trending Topics

Online now

Members online
1,142
Guests online
1,903
Total visitors
3,045

Forum statistics

Threads
2,293,874
Posts
29,087,195
Members
1,207,986
Latest member
davidsanyal32
Back
Top