Part 1: Complete A, B, and C in a single program with multiple loops (not nested). A. Create a loop that will output all the positive multiples of 9 that are less than 99. • Increment your loop counter by 1 during each iteration. • Output the multiples on a single line with 8 spaces in between each multiple. B. Create a loop that will output all the positive numbers less than 500 that are evenly divisible by both 3 and 7. • Increment your loop counter by 1 during each iteration. • Use a logical operator when determining if a number is divisible by 3 and 7. • Beginning on a new line, output the multiples on a single line with 4 spaces in between each number. • Once you have outputted five numbers, move to the next line and carry on. C. Create a loop that will calculate the sum of the positive multiples of 13 that are between 50 and 350. • Output the sum by itself on a new line.
Added by Josefa B.
Close
Step 1
```python # Part A: Output all positive multiples of 9 that are less than 99 for i in range(1, 99): if i % 9 == 0: print(i, end=' ') # 8 spaces print() # New line after the loop ``` Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 74 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 C++ statements to do the following: Declare an array alpha of 50 components of type int. Initialize each component to -1. Output the value of the first component of the array alpha. Set the value of the twenty-fifth component of the array alpha to 62. Set the value of the tenth component of alpha to three times the value of the fiftieth component of alpha plus 10. Use a for loop to output the value of a component of alpha if its index is a multiple of 2 or 3. Output the value of the last component of alpha. Output the value of alpha so that 15 components per line are printed. Use a for loop to increment every other element (the even indexed elements). Use a for loop to create a new array, diffAlpha, whose elements are the differences between consecutive elements in alpha.
Aarya B.
Use a for loop to print the numbers from 0 to 25 across the screen with a space between each one. Use a for loop to print the numbers from 10 to 1 across the screen with a space between each one. Use a for loop to print the odd numbers from 1 to 40 across the screen with a space between each one. Use a for loop to print the even numbers from 2 to 40 across the screen with a space between each one. Use a for loop to print the numbers from 0 to 200 in increments of 10 across the screen with a space between each one. Use a for loop to print the string literal "computer" 10 times down the screen. Sample Run: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 10 9 8 7 6 5 4 3 2 1 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 computer computer computer computer computer computer computer computer computer computer
Liam H.
I need a C program. 14.7 Homework 3 P1: Countdown until digits are odd and find the average. Write comments in your program. Programs with no comments will receive a 1 point deduction. For each program that you turn in, at least the following information should be included at the beginning of your code as comments: Author, Date created, Brief description of the program input(s), output(s), and brief algorithm. Write a C program that takes an integer n (in the range 10-99, inclusive) as input. The outputs are: 1) a countdown starting from the integer and stopping when both output digits are odd, and 2) the average from all countdown numbers. Example: If the input is 57, the output is 57 average is 5.00. Example: If the input is 89, the output is 89 88 87 86 85 84 28 19 7 9 average is 4.00. Example: If the input is any number not between 10 and 99 (inclusive), the output is "Input must be 10-99". For coding simplicity, follow each output number by a space, even the last one. Add a new line character after the statement showing the average value.
Supreeta N.
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