Assignment-2 (Introduction To C Programming and Decision Statement)
Assignment-2 (Introduction To C Programming and Decision Statement)
Sample Input:
Sample Output:
2. Take a number as an input, print the number and number of digits in the number using
only “printf()” statement(s).
Sample Input:
Enter the number:
Sample Output:
Number is: and the numbers of digits are:
3. Write a C program that takes the date of birth of the person as input in
and calculate the present age of the person. You should print the age in the format of
formate.
Sample Input:
Enter the date of birth:
Sample Output:
The present age is:
Sample Input:
Enter
Sample Output:
Odd parity
5. Write a C program to print the calendar of a month of 31 days. The program would ask
for the day on which the first date of the month occurs.
Sample Input:
Enter the day of the 1st date of month: Wednesday
Sample Output
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
6. Write a program that takes the year as input and determines whether it’s a leap year or
not.
Sample Input:
Enter year: 2020
Sample Output:
It’s a leap year!!!
Sample Input:
Enter the character: A
Sample Output:
It’s a capital letter.
2. If the three sides of a triangle are entered through the keyboard, write a program to check
whether the triangle is isosceles, equilateral, scalene or right angled triangle.
Sample Input:
Enter the sides: 3, 4, 5
Sample Output:
It’s a right angled triangle.
3. A university has the following rules for a student to qualify for a degree with A as the
main subject and B as the subsidiary subject:
Write a program to receive marks in A and B and Output whether the student has passed,
failed or is allowed to reappear in B.
Sample Input:
A = 68, B = 40
Sample Output:
Student can reappear for the exam