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.