You are on page 1of 1

Ex -2 Programs using control structures – 1

1. Suppose that we have a temperature reading from a sensor inside a large


piece of machinery. We want to print a message on the control screen to
inform the operator of the temperature status. If the status code is 10, the
temperature is too hot and the equipment should be turned off; if the status
code is 11, the operator should check the temperature every 5 minutes; if the
status code is 13, the operator should turn on the circulating fan; for all other
2. status codes, the equipment is operating in a normal mode. Write a program
to solve this problem using (i) if-else and (ii) switch-case statements.
3. Generate a conversion table for converting degrees to radians (note that the
degree values start at 0°, increment by 10°, and go through 360°) using (i)
while loop (ii) do-while loop
4. Write a program to print all the ASCII values and its equivalent characters
using a while loop. ASCII values vary from 0 – 255.
5. Write a program to reverse an integer value and check whether the reversed
number is equivalent to original number (Print message as Palindrome) or
not (Print not a palindrome).
Original: 1234 Reverse: 4321 Not a Palindrome
Original: 1221 Reverse: 1221 Palindrome
(Hint: 1234 = 1000+200+30+4 , 4321 = 4000+300+20+1 use %, /,+)

VIVA: (25 Marks)


Let us C by Yashavant Kanetkar
Chapter 2: Decision Control Structures Ex A , B, D, E, F
Chapter 4: Case control Instructions Ex [A] [B]

You might also like