Assignment No. 1
Semester: Fall 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.
Write a C++ program that performs the following tasks:
1-Storethe first two alphabets
of your Student
IDin 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 IDusing a loopand display the last two digits of thereversed 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.
Solution: