1st October 2025
Fundamentals of Programming
Lab 4
General Instructions (Read carefully)
All tasks listed below are to be solved in given three hours these tasks will be evaluated and
graded accordingly.
Students are not allowed to talk to each other, if you have any questions please raise your hand
and remain seated unless you are allowed to move. No query or question will be entertained
unless you have some rough work to show your logic.
If any students is found cheating / copying code from internet / copying code from another
student, them consequences can lead towards, F grade in this course.
1. Write a program that checks if a number is positive, zero,
or negative using comparison operators.
2. Write a program that compares two numbers and
displays which one is larger or if they are equal
(true/false).
3. Write a program that checks if a number is between 1
and 100 using logical AND operator.
4. Write a program that reads a full name with spaces using
getline() and displays its length.
5. Write a program that concatenates first name and last
name into a full name and displays its size.
Page 1 of 2
1st October 2025
6. Write a program that reads a sentence and displays the
number of characters in it.
7. Write a program that compares two strings and checks if
they are equal.
Page 2 of 2