🔒 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
  • 539
    Views
  • 5
    Participants
Last reply from:
I am nobody

Trending Topics

Online now

Members online
1,158
Guests online
2,908
Total visitors
4,066

Forum statistics

Threads
2,331,821
Posts
29,260,568
Members
1,147,835
Latest member
shsjsjkssksn
Back
Top