# Write a while loop that prints A. All squares less than n. For example, if n is 100, print 0 1 4 9 16 25 36 49 64 81. B. All positive numbers that are divisible by 10 and less than n. For example, if n is 100, print 10 20 30 40 50 60 70 80 90 C. All powers of two less than n. For example, if n is 100, print 1 2 4 8 16 32 64.

###### Question:

A. All squares less than n. For example, if n is 100, print 0 1 4 9 16 25 36 49 64 81.

B. All positive numbers that are divisible by 10 and less than n. For example, if n is 100, print 10 20 30 40 50 60 70 80 90

C. All powers of two less than n. For example, if n is 100, print 1 2 4 8 16 32 64.

## Answers

Answer:The program to this question as follows:Program:#include <iostream> //defining header fileusing namespace std; int main() //defining main method{int squ=0,n=0; //defining variablecout<<"Square between 0 to 100 :"; //messagewhile(n<100) //loop for calculate Square{n=squ*squ; //holing value in n variablecout<<n<<" "; //print Squaresqu++; //increment value by 1}cout<<endl; //for new linen=1; //change the value of ncout<<"Positive number, which is divisible by 10: "; //messagewhile (n< 100) //loop for check condition{if(n%10==0) //check value is divisible by 10{cout<<n<<" ";//print value }n++; //increment value of n by 1} cout<<endl; //for new linecout<<"Powers of two less than n: "; //messagen=1; //holing value in nwhile (n< 100) //loop for check condition{cout<<n<<" ";//print valuen=n*2; //calculate value}return 0;}Output:Square between 0 to 100 :0 1 4 9 16 25 36 49 64 81 100 Positive number, which is divisible by 10: 10 20 30 40 50 60 70 80 90 Powers of two less than n: 1 2 4 8 16 32 64 Explanation:In the above program, two integer variable "squ and n" is defined, then three while loop is declared, which is used to calculate different values, that can be described as follows: In the first while loop both "n and squ" variable is used, in which n is used for check range and "squ" is used to calculate the square between 1 to 100. The second, while it is used to calculate the positive number, which is divisible by 10, in this only n variable is used, that calculates the value and check its range. Then the last while loop is used which is used to calculate the double of the number, which is between 1 to 100 range.