CS201 MID TERM SOLVED MCQs || PAST PAPERS || GROUP-1 || INTRODUCTION TO PROGRAMMING || VuTech Visit Website For More Solutions www.vutechofficial.blogspot.com …
Visit Website For More Solutions www.vutechofficial.blogspot.com
KINDLY, DON’T COPY PASTE
Question No. 1
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.)
cout<<lastDigit << "
is not a prime number." << endl;
}
return 0;
}
KINDLY, DON’T COPY PASTE SUBSCRIBE, SHARE, LIKE AND COMMENTS FOR MORE UPDATES SEND WHATSAPP OR E-MAIL FOR ANY QUERY 0325-6644800 kamranhameedvu@gmail.com Visit Website For More Solutions www.vutechofficial.blogspot.com
We provide Virtual University of Pakistan Study Materials such as Solution of Assignments, GDBs, Mid Term Solved Papers, Final Term Solved Papers, Mid Term Solved MCQs, and Final Term Solved MCQs. We also provide regular Semester Quizzes, Updated Handouts, and Short Questions and Answers. We help you with your research and many other educational-related topics, as far as we know. Furthermore, Share your problem with us and Please feel free to ask any related questions.