Pseudocode - Output number 3 times?

Hey all, taking a programming logic and design course (OOP related) and I’m kind of stuck on a task from an assignment:

1) Write the pseudocode for an application that accepts a number as input and displays the number three times.

I imagine you would use a loop to do this, but we haven’t covered loops yet. Just methods, classes, and data. So is there a way I can do this without using a loop?

Heres an example, another task told me:

Write the pseudocode for an application that accepts two numbers and displays the sum of the two numbers.

to which I did:

start
input myNumber1
input myNumber2
myAnswer = myNumber1 + myNumber 2
output myAnswer
stop

So i’m looking for some help on how to answer #1 at top of my post without using looping if possible.

Thanks in advance,
Chris

I’m surprised you have covered classes before covering basics like loops.

So if you can’t use loops, just input the number and output it 3 times with 3 write statements (system.out.println()).

It’s a terrible book that jumps around a lot (it had some BAD reviews written about it), but thanks that’s what I was thinking about doing!

Thanks webdev

-Chris

are you asking any logic to print the numbers in 3 times without loop?

I hope you got answer for your question. let us know otherwise.

Hi,
just for the sake of it :slight_smile:
I’m learning java


class Test {
  int count = 0;
  void times(int n) {
    if(count==3) return;
    else count++;
    System.out.println("Time is " + count + " " + n);
    times(n);
   }
}
class Threetime {
  public static void main(String args[]) {
    Test t = new Test();
    t.times(10);
  }
}

Java The complete Reference

I think it’s better :slight_smile:
clear and easy to read