🔒 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
 

Attachments

  • Screenshot_2020-10-03-09-27-14-09.webp
    Screenshot_2020-10-03-09-27-14-09.webp
    9.1 KB · Views: 14
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
  • 519
    Views
  • 5
    Participants
Last reply from:
I am nobody

Online now

Members online
1,017
Guests online
893
Total visitors
1,910

Forum statistics

Threads
2,276,230
Posts
28,968,483
Members
1,231,174
Latest member
jpryno
Back
Top