CS112 Assignment-2 (G9-G12)
CS112 Assignment-2 (G9-G12)
1. Make sure to give the correct information in your submission link. You will receive a
response email for every submission. You must save it for future reference for the
whole semester as you will be asked to show it.
2. Every assignment will have multiple questions. For every question, you will save your
solution (i.e. program) as a .c file. So if “Assignment 01” has 4 questions (marked as 1,
2, 3 and 4), then you will save your solution program as 1.c, 2.c, 3.c and 4.c
Note: Your program will be compiled to check if your solution is correct and you
will be marked accordingly. If any solution file is missing or not submitted, the
marks for that solution will be zero.
3. Submit your files in a compressed folder (rar or zip) as per “submission instructions” given
in your assignment question paper.
Note: You must make sure to upload in .zip or .rar. Files submitted with any other
extension or wrong extension will not be evaluated and awarded zero.
4. The student must ensure that the submitted file is not corrupted and can be unzipped
properly. Corrupted files that cannot be opened will be given zero.
5. You will be able to upload your assignment only once and no plea/request for any
relaxation will be entertained. So, make sure to carefully check that you are submitting
the correct assignment.
6. The submission link will be automatically deactivated after the deadline, and no
request/plea for extension will be accepted. Non-submission will be automatically
awarded zero.
7. Your code will be checked for similarity and you will be penalized according to the following
rule:
The similarity between 50% to 75%: 25% deduction
The similarity between 75% to 100%: 50% deduction
For coding, you may take help of online compilers. Some are listed below
1. https://paiza.io/en/projects/new?language=c
2. https://www.onlinegdb.com/online_c_compiler
3. https://www.codechef.com/ide
CS112: Programming & Data Structure Laboratory (G9-G12)
Date: 21 April 2021
Assignment 2
Submission deadline: 22.04.2021 - 6:00 pm
Submission Instruction: Store your assignments in folder and compress it as a rar/zip file
(filename should be in this format: roll-number_assign2.rar or roll-number_assign2.zip). For
example, if your roll number is 1921CS01, store your assignment as 1921CS01_assign2.rar or
1921CS01_assign2.zip. Also, save each program in the format given beside each question.
Upload the same at the below link:
https://docs.google.com/forms/d/e/1FAIpQLSf71MoNQYVssJ8KtKw_nCD9GtanUKedeGj19Xl0OhFD1oiiiw/viewform?usp=sf_link
Problem 1 (Save as 1.c):- Write a c program to enter a positive number (taken from
user) and count the number of digits present in that number and if the number of digits
are between 1 to 12 then display the corresponding month of the year using switch case
statement.
Test case 1:
input:-
output:-
march
Test case 2:
input:-
output:-
not possible
output:-
invalid input
Problem 2 (Save as 2.c):- Write a c program to print the following pattern. Take input as
the number of rows from user.
Test case 1:
input:-
output:-
2 3 5 7 11 13 17
19 23 29 31 37
41 43 47
53
Test case 2:
input:-
output:-
2 3 5 7 11 13 17 19 23
29 31 37 41 43 47 53
59 61 67 71 73
79 83 89
97
Test case 3:
input:-
output:-
invalid input
Problem 3 (Save as 3.c):- Write a c program to read input until user enter a positive
even length palindrome.
Enter the number = 4334 [positive even length palindrome so program stops]
Note:-