Loop Control Statements 193
3) Develop a program to simulate seconds clock. Put the 60 dots on the circle with equal distance
between each other and mark them 0 to 59. A second's pointer is to be shown with any symbol.
Also print the total number of revolution made by second's pointer.
4) Write a program to simulate analog watch (1 to 12 numbers to be arranged in circular fashion
with all the three pointers for seconds, minutes, and hours) on the screen. Use nested fo r loops.
a) Use (.) dot for second's pointer.
b) Use (*) star for minute's pointer.
c) Use (#) hash for hour's pointer.
5) Write a program to calculate sum of the first and the last number from 1 to 10.
(Example 1+10,2+9,3+8 sums should be always 11)
6) Write a program to find the total number of votes in favor of persons 1A' and % B'. Assume 100
voters will be casting their votes to these persons. Count the number of votes gained b y% A' and
' B'. User can enter his/her choices by pressing only 'A7 or 1B'.
7) Write a program to pass the resolution in a meeting comprising of five members. If three or more
votes are obtained the resolution is passed otherwise rejected.
8) Assume that there are 99 voters voting to a person for selecting chairman's candidature. If he
secures more than 2/3 votes he should be declared as chairman otherwise his candidature will
be rejected.
9) Write a program to display the numbers of a series 1,3,9,27,81... .n, by using fo r loop.
10) Write a program to check the entered input data for the following. Whenever input is non-zero
or positive display numbers from 1 to that number otherwise display message "Negative or
zero". The program is to be performed for 10 numbers.
11) Write a program to check entered data types for 10 times. If character is entered print "Character
is entered" otherwise "Numeric is entered" for numerical values.
12) Write a program to find the sum of first hundred natural numbers. (1+2+3+..100).
13) Write a program to display numbers 11,22,33
.....
99 using ASCII values from 48 to 57 in loops.
14) Create an infinite fo r loop. Check each value of the fo r loop. If the value is odd, display it
otherwise continue with iterations. Print even numbers from 1 to 100. Use break statement to
terminate the program.
15) Write a program to show the display as a rectangle of characters as shown below.
Z
YZY
XYZYX
RXYZYXR
XYZYX
YZY
Z
16) Write a program to read ten numbers through the keyboard and count number of positive,
negative and zero numbers?
17) Write a nested fo r loop that prints a 5 X 10 pattern of 0s.
18) Is it possible to create a loop using goto statement? If yes write a code for it.
19) Write a program to find the triangular number of a given integer. Fox example triangular of 5 is
(1+2+3+4+5) 15. Usedo-whileloop.
20) Write a program to display all ASCII numbers and their equivalent characters numbers and
symbols. Use do-while loop. User should be prompt every time to press %y ' or 'N'.Iftheuser
presses %y ' display the next alphabet otherwise terminate the program.
21) Accept any five two numbers. If the first number is smaller than the second then display the sum
of their squares, otherwise sum of the cubes.