Sei sulla pagina 1di 2

Department of Software Engineering

Programming Fundamentals-1
Assignment 2
Section: S, T, U Deadline: 02-11-2018

Instructor Name: Faiza Khadim Total Marks: 5-Marks

Instructions:
 This assignment is related to Selection Statement.
 All program codes should be written in C/C++ by using Dev C++/ Visual studio compiler
for coding.
 Plagiarism in the work is professional dishonesty which leads to strict disciplinary action
and zero in grading of assignment.
 Assignment evaluation is totally based on viva.

Question 1
Write a program that reads in five integers, determines and prints the largest and the smallest
integers in the group.
Question 2
Write a program that reads in two integers and determines and prints if the first is a multiple of the
second.
Question 3
a. Write a program that takes your Mathematics marks (out of 100) as input and prints them.
b. Print your teacher’s comments about your Mathematics marks based on the following
condition:
i. If your score is less than 70, print “Work harder”.
ii. If your score is greater than or equal to 70, print “Fairly good!”
iii. If your score is greater than or equal to 75 and less than 85, print “Very good”.
iv. If your score is greater than or equal to 85, print “Outstanding”.

Question 4
Write and run a program that simulates a simple calculator. It reads two integers and a character.
If the character is a +, the sum is printed; if it is a -, the difference is printed; if it is a *, the product
is printed; if it is a /, the quotient is printed; and if it is a %, the remainder is printed. Use a switch
or if else statement.
Expected Output
Enter two integers: 30 13
Enter an operator: %
Answer: 4

Department of Software Engineering


Question 5
Write a program used for selecting TAs. The program takes as input, the student’s cgpa, student’s
gpa in programming course and the warning count and checks whether the student is eligible for
TAship or not. There are four types of TAships offered to a student according to following criteria.
A student is eligible for TAship only if he/she has a CGPA above 3 and his/her GPA in
programming course is also above 3. There must be no warning counts to be selected for TAship.
If CGPA and GPA in course are above 3 then the student is selected as
full time TA if he/she is full time student of MS.
part time TA if he/she is part time student of MS.
part time TA if he/she is student of BS and has course GPA greater than 3.3.
Not eligible if none of the above three conditions is satisfied.
Expected Output

Enter your CGPA: 3.8 Enter Warning Count: 0 Enter your PF GPA: 3.9
Enter Degree (M for MS and B for BS): M
Enter Degree Type (P for Part time and F is for Full time): P you are Eligible for part time
TAship.

Question 6
A program that takes input of a number then prints whether is it negative or positive using switch.
Question 7
A program that takes input of a character as Small alphabet then prints it in capital and vice versa.
(Hint ASCII code of A-Z: 65-90 AND a-z: 97:122) using switch statement
Question 8
Any character is entered by the user. write a program to determine whether the character entered
is a capital letter, a small case letter, a digit or a special symbol. The following table shows the
range of ASCII values for various characters.
Characters ASCII Values
A-Z 65-90
a-z 97-122
0-9 48-57
Special symbols 0-47, 58-64, 91-96, 123-127

Good Luck 😊

Department of Software Engineering

Potrebbero piacerti anche