0% found this document useful (0 votes)
106 views

CS112 Assignment-2 (G9-G12)

1. The document provides instructions for submitting assignments for the CS112 programming course. 2. Students must submit their assignment solutions as individual .c files within a compressed folder with their roll number and assignment number. 3. Submissions will be checked for plagiarism and deducted marks if the similarity is between 50-75% or above 75%.

Uploaded by

Shubham raj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views

CS112 Assignment-2 (G9-G12)

1. The document provides instructions for submitting assignments for the CS112 programming course. 2. Students must submit their assignment solutions as individual .c files within a compressed folder with their roll number and assignment number. 3. Submissions will be checked for plagiarism and deducted marks if the similarity is between 50-75% or above 75%.

Uploaded by

Shubham raj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CS112 (G9-G12)

READ THE FOLLOWING INSTRUCTIONS CAREFULLY. FAILING TO ADHERE TO IT

WILL LEAD TO DEDUCTION OF MARKS

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:-

Enter a positive number = 235

output:-

march

[explanation:- because 235 contains 3 digits so the corresponding month is march]

Test case 2:

input:-

Enter a positive number = 2356465486854

output:-

not possible

[explanation:- because it contains 13 digits ]


Test case 3:

Enter a positive number = -2

output:-

invalid input

[explanation:- because it contains non positive number ]

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:-

Enter the number of rows = 4

output:-

2 3 5 7 11 13 17

19 23 29 31 37

41 43 47

53

[Explanation:- all are prime number starting from 2]

Test case 2:

input:-

Enter the number of rows = 5

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:-

Enter the number of rows = -4

output:-

invalid input

[Explanation:- because it is non positive number]

Problem 3 (Save as 3.c):- Write a c program to read input until user enter a positive
even length palindrome.

Test case 1:-

Enter the number = 121 [odd length palindrome]

Enter the number = 220 [not a palindrome]

Enter the number = 1425 [not a palindrome]

Enter the number = -1221 [non positive number]

Enter the number = 4334 [positive even length palindrome so program stops]

Note:-

0220 is not considered as palindrome it is considered as 220.

You might also like