1
Programming Fundamental
Submitted by :-
Name Muhammad Asbah Khan
Roll No. E01
Submitted to :-
Teacher Name Shahzeb Iqbal
CS-Self 1st Semester
University of Mianwali .
Assignment – Lecture 7 M. Asbah Khan
2
Question 1 :-
• Population Growth: Simulate a population growth where the population
doubles each year until it exceeds a certain limit.
Program Output :-
Assignment – Lecture 7 M. Asbah Khan
3
Question 2 :-
• Bank Balance: Write a program that calculates the balance of a bank account
after each transaction until a user decides to exit.
Program Output :
Assignment – Lecture 7 M. Asbah Khan
4
Question 3 :-
• Guess the Number: Implement a number guessing game where the user has to
guess a randomly generated number using a while loop.
Program Output :-
Assignment – Lecture 7 M. Asbah Khan
5
Question 4 :-
• Temperature Conversion: Create a program that converts temperatures
between Celsius and Fahrenheit until the user decides to stop.
Program Output :
Assignment – Lecture 7 M. Asbah Khan
6
Question 5 :-
• Menu-Driven Calculator: Develop a simple calculator that performs basic
operations (addition, subtraction, multiplication, division) based on user input
until they choose to exit.
Program Output :
Assignment – Lecture 7 M. Asbah Khan
7
Question 6 :-
• Filling a Backpack: Write a program that allows the user to add items to a
backpack until its weight exceeds a certain limit.
Program Output :
Assignment – Lecture 7 M. Asbah Khan
8
Question 7 :-
• Multiplication Table: Print the multiplication table for a given number until a
specified limit is reached.
Program Output :
Assignment – Lecture 7 M. Asbah Khan
9
Question 8 :-
• Car Rental System: Implement a simple car rental system where users can
rent a car for a specified number of days and calculate the total cost.
Program Output :
Assignment – Lecture 7 M. Asbah Khan
10
Question 9 :-
• Ticket Sales: Simulate ticket sales for an event until a certain number of tickets
are sold out.
Program Output :
Assignment – Lecture 7 M. Asbah Khan
11
Question 10 :-
• String Reversal: Take a string as input and reverse it using a while loop.
Program Output :
Assignment – Lecture 7 M. Asbah Khan