Ask Question
27 April, 05:24

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

+1
Answers (2)
  1. 27 April, 06:14
    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. 27 April, 06:52
    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?
Find an answer to your question ✅ “Design the logic for a program that outputs every number from 1 through 15. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers