Ask Question
17 November, 15:12

Design the logic for a program that outputs every number from 1 through 15.

+2
Answers (2)
  1. 17 November, 15:33
    0
    Another way to think about this is through the use of a loop, since printing a number is a very repetitive task, you could also use,

    number = 1

    while number < 16:

    print (number)

    number = number + 1

    The logic behind this is the "while" loop would check whether the variable 'number' is less than 16 (i. e. between 1 and 15) if so, it prints the number and then adds one to it. It then repeats the check over and over until 16 is reached and then the program terminates.
  2. 17 November, 18:17
    0
    Not sure what programming language, but i'll use Java

    print (1)

    print (2)

    print (3)

    print (4)

    print (5)

    print (6)

    print (7)

    print (8)

    print (9)

    print (10)

    print (11)

    print (12)

    print (13)

    print (14)

    print (15)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Design the logic for a program that outputs every number from 1 through 15. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers