Friday, 9 October 2026

Assignment 2

                                       C PROGRAMMING – ASSIGNMENT 2

Online execution and submission deadline: 24/10/2026 before 2:00 PM

Written assignment deadline: 31/10/2026 before 5:00 PM

Submission Instructions

  1. Write and execute each C program using the online GDB Compiler.
  2. Take a clear screenshot of each program’s execution, including the program output. Write same program and output in your assignment book. Copy and Paste the screenshots of program and result into an MS Word file and keep with you.
  3. Write each C program and its result in the same assignment book used for Assignment 1 after executing programs and maintaining word file.
  4. When submitting the written assignment book, show the MS Word file containing your screenshots to the teacher.

Written assignment submission place: Staff Room

Note: Online GDB is the compiler, not the place to submit the written assignment book.

Rules and Regulations

  1. At the beginning of every program, display your full name and serial number.
  2. Include the date-and-time code provided in class in every program. When the program runs, it must display the system date and time. Record the program’s output, including the displayed date and time, in your assignment book. The code is time_t now = time(NULL); printf("Date and time: %s", ctime(&now));
  3. Wherever a question uses n, use your serial number as the value of n. For example, if your serial number is 18 (1+8=9), use n9 instead on n.
  4. Write and test each program yourself. Do not copy another student’s program or submit someone else’s work.
  5. Use meaningful variable names (with number), proper indentation, and suitable prompts and output messages. Add comments where they help explain your logic.
  6. Test each program and record its output neatly. Check that your name, serial number, and date and time are displayed correctly.
  7. Be prepared to run your programs and explain how they work. The teacher may ask you to make a small change or answer questions about your code.

                                                             List of Programs

 1.      Largest and Smallest: Write a C program to read n numbers and display the largest and smallest numbers.

2.      Largest Even and Largest Odd: Write a C program to read n integers and display the largest even number and the largest odd number. If the input contains no even or no odd numbers, display an appropriate message.

3.      Student Result and Grade: Write a C program to read marks from 0 to 100 and display the result according to the grade criteria given in Assignment 1. Also display an error message if the entered marks are outside the valid range.

4.      Numbers Divisible by 3 and 7: Write a C program to display the first n positive numbers divisible by both 3 and 7.

5.      Prime Number: Write a C program to read an integer and determine whether it is Prime.

6.      Frequency of a Number: Write a C program to read n integers and another integer x, then display how many times x occurs.

7.      Sum of Digits: Write a C program to read an integer and display the sum of its digits. Make sure your program also handles zero and negative input.

8.      Reverse and Palindrome: Write a C program to read an integer, reverse its digits, and determine whether the original number is a palindrome.

GDB online classroom: https://onlinegdb.com/classroom/invite/xKMPtFxJ8 

No comments:

Post a Comment

Assignment 2

                                        C PROGRAMMING – ASSIGNMENT 2 Online execution and submission deadline: 24/10/2026 before 2:00 PM ...