Search code examples
pseudocode

Something similar?


I'm in my first year and I have to do some problems in a new programming language invented by my teacher which is very similar with java

The problem is: Write a program that asks the user to enter a number. It will then repeatedly display the message "hello" twice the number of times as the number entered. So if you entered 3 it should print "hello" 6 times.

So far I did this:

get number
set p=number*2
for p=1 to 100
 repeat 
  display "hello"
 until number !=p
endfor

What am I doing wrong ?


Solution

  • get number
    set p=number*2
    for i=1 to p
      display "hello"
    endfor