
Practice Lab Assignment
1. A palindrome is a number or a text phrase that reads the same backward as
forward. Example, each of the following 5-digit integers is a palindrome:
12321, 55555, 45554, 11611.
Write a program that reads a five digit integer and determines whether or not
itโs a palindrome. [Hint: use โ%โ and โ/โ operators to separate individual
digits.]
2. Assume integer i = 1, j=2, k=3 and m=2. What does each of the following
statements print?
I. printf(โ%dโ, i = = 1);
II. printf(โ%dโ, j = = 3);
III. printf(โ%dโ, i > = 1 && j < 4 );
IV. printf(โ%dโ, m <= 99 && k < m);
V. printf(โ%dโ, j > = 1 || k = = m);
VI. printf(โ%dโ, k+m < j || 3 โ j > = k);
VII. printf(โ%dโ, !m);
VIII. printf(โ%dโ, !(j - m));
IX. printf(โ%dโ, !(k > m));
X. printf(โ%dโ, !(j > k));
3. If the ages of Ram, Shyam and Ajay are input through the keyboard, write a
program to determine the youngest of the three using ternary operator โ?:โ.
4. Any character is entered through the keyboard, write a program to determine
whether the character entered is a capital letter, a small letter, a digit or a
special symbol using switch statement with if-else.
0-47, 58 โ 64, 91-96, 123-127