Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Assignment on C language, Assignments of Introduction to Computing

C language assignment including arrays and pointer.

Typology: Assignments

2021/2022

Available from 10/13/2022

mansi-kulshreshtha
mansi-kulshreshtha 🇮🇳

4 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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.
Character
ASCII Values
A-Z
65-90
a-z
97-122
0-9
45-57
Special symbols
0-47, 58 64, 91-96, 123-127
pf2

Partial preview of the text

Download Assignment on C language and more Assignments Introduction to Computing in PDF only on Docsity!

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. Character ASCII Values A-Z 65- a-z 97- 0-9 45- Special symbols 0-47, 58 – 64, 91-96, 123-
  1. Write a program to print this triangle:
    **







Hint: Use while loop

  1. Write a menu driven program (using switch) which has following options: I. Odd or even II. First number is multiple of the second number or not. III. Sum of digits of a given number is odd or even Once a menu item is selected the appropriate action should be taken.
  2. Write a program to find number of days in a month using switch statement.