Ask Question

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

+4
Answers (2)
  1. 9 September, 01:55
    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. 9 September, 01:57
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers