Professional Documents
Culture Documents
CS201P Assignment#1 Solution 2023 by Artist
CS201P Assignment#1 Solution 2023 by Artist
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.)
Sample screenshot:
NOTE: Student must use his/her own VU ID otherwise Zero marks will be awarded (Zero Tolerance).
Solution
Join Whatsapp Group Word File Link