In: Computer Science
10. Write a for loop which will print every number evenly divisible by 13 between 1 and 100, inclusive. Your loop will only increment by 1 each loop so you need an if test to see if each number should be printed. Put each number output on the same line, 1 space apart.
11. Write a while loop which will prompt the user for a number and accept their input and then display this message (assuming number input is 3) "Your number squared is 9". The loop will stop when zero ( 0 ) is entered. Zero, when entered, will not cause output to appear.
12. The following code is found in a friend's program but when average is displayed on the screen it is wrong. Correct the line computing average.
int a=3, b=4;
double average;
average = a + b / 2;
13. Write a for loop which will make the computer beep Num times where Num is a variable defined elsewhere in your program. Use counter to control the loop.
short counter;
14. Write a switch statement that will print “hello” if the variable Num is 1, 2, or 3. If the variable Num is 4 print “goodbye” . If Num is anything else, print “Bad Data”