Question 4 Write a Python program that uses For loop to read five integers, and for each integer prints whether it is a multiple of 3. Hint: n is a multiple of 3 when n % 3 == 0 Sample Run Enter number 1: 7 7 is NOT a multiple of 3 Enter number 2: 6 6 is a multiple of 3 Enter number 3: 9 9 is a multiple of 3 Enter number 4: 8 8 is NOT a multiple of 3 Enter number 5: 3 3 is a multiple of 3 (10 Marks - Input and convert: 3 marks | Loop: 2 marks | Condition: 3 marks | output: 2 marks)
Added by Alfredo R.
Close
Step 1
The for loop will run five times and it will print out whether the integer is a multiple of 3. Here is the code for the for loop: for i in range(5): if i%3==0: print("Integer " +i+ " is a multiple of 3.") else: print("Integer " +i+ " is not a multiple of Show more…
Show all steps
Your feedback will help us improve your experience
Sarvesh Somasundaram and 54 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a program that uses a while loop to calculate and print the multiples of 3 from 3 to 21. Your program should print each number on a separate line. Expected Output 3 6 9 12 15 18 21 in python
Sarvesh S.
Aarya B.
Write the function called print_pattern that takes an integer number as an argument and prints the following pattern if the input number is 3: * ** *** in Python
Willis J.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD