Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Assignment No.

1 Total Marks: 20

Semester: Fall 2023 Due Date: 15/11/2023


CS201P – Introduction to Programming Practical
Instructions
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:

o Assignment is submitted after due date.


o Submitted assignment does not open or file is corrupt.
o Assignment is copied (From internet/students).

Recommended tool to develop Assignment


- Dev C++

Objectives:
To enable students to understand and practice the concepts of:

 Conditions
 Functions
 Loops
 Why paying attention to details is important?

Assignment Submission Instructions


You have to submit only.cpp file on the assignments interface of CS201P from your LMS account. Assignment
submitted in any other format will be scaled with zero marks. So, check your solution file format
before submission.

For any query related to assignment, please contact cs201p@vu.edu.pk


Assignment

Lectures: 1 to 9
Write a C++ program that performs the following tasks:

1-Store the first two alphabets of your Student ID in a variable and identify whether your study program is
Bachelors or Masters using the following criteria.

Example
If ID is bc523456789 the output will be “Program Name: Bachelors”
If ID is mc523456789 the output will be “Program Name: Masters”
Otherwise the output will be “Program Name : Unknown”

2- Reverse only the digits of the Student ID using a loop and display the last two digits of the reversed ID.

For Example, the reverse of 523456789 is 987654325, the last digits (25) should be displayed.

3- Using the reversed ID, identify if the last digit is prime or not (use functions to implement this
functionality).

For example, using the reversed ID 987654325, the last digit is 5 which is a prime number.

(Hint: A prime number is a whole number greater than 1 that cannot be exactly divided by any whole number other
than itself and 1.)

Note: Pay attention to details while solving problem statements.

Sample screenshot:

NOTE: Student must use his/her own VU ID otherwise Zero marks will be awarded (Zero Tolerance).

You might also like