0% found this document useful (0 votes)
38 views

Lab Exercise 04: Product Product

The document provides instructions for 4 while loop exercises: 1) Print multiples of 3 from 300 to 3. 2) Print odd numbers from 1 to 99 and calculate the total. 3) Have the user enter a number that gets multiplied by 10 each iteration until the product exceeds 100. 4) Ask the user for a positive integer and calculate the sum of all integers from 1 to that number. The exercises are meant to practice using while loops for counting, calculations, and user input.

Uploaded by

Aljawad14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Lab Exercise 04: Product Product

The document provides instructions for 4 while loop exercises: 1) Print multiples of 3 from 300 to 3. 2) Print odd numbers from 1 to 99 and calculate the total. 3) Have the user enter a number that gets multiplied by 10 each iteration until the product exceeds 100. 4) Ask the user for a positive integer and calculate the sum of all integers from 1 to that number. The exercises are meant to practice using while loops for counting, calculations, and user input.

Uploaded by

Aljawad14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Lab Exercise 04

Using while-loop

1. Write a while loop to print the multiples of 3 from 300 down to 3.


2. Write a while loop to print the odd numbers from 1 to 99 (inclusive). Your
program must able to calculate the total odd numbers.
3. Write a while loop that lets the user enter a number. The number input by the user
should be multiplied by 10 and store the result in the variable named
product.The loop should iterate as long as product contains a value less than
100.
4. Write a program that asks user the user for a positive integer value. The program
should use a loop to get the sum of all the integer s from 1 up to the number
entered. For example, if the user enters 50, the loop will find the sum of 1, 2, 3,....
50.

Faculty of Information and Computing Technology | BTT121 | Page 1 of 1

You might also like