Professional Documents
Culture Documents
Tutorial Assignment: 2
Tutorial title: Flowchart representation and algorithm/logic writing practice
CO Mapping
Algorithms Algorithm can be defined as: “A sequence of activities to be processed for getting desired
output from a given input.”
Main properties of an
Algorithm
Problem Solving Problem solving is the act of defining a problem; determining the cause of the problem;
identifying, prioritizing, and selecting alternatives for a solution; and implementing a
solution. The problem-solving process. Problem solving resources.
Flowcharts A flowchart is a type of diagram that represents an algorithm, workflow or process. The
flowchart shows the steps as boxes of various kinds, and their order by connecting the boxes
with arrows. This diagrammatic representation illustrates a solution model to a given
problem. Flowcharts are used in analyzing, designing, documenting or managing a process
or program in various fields.
Symbols Used
Flowchart and Algorithms
Exercise:
Question 2. Write an algorithm that inputs the age of a person and check whether he/she is eligible to vote or not.
A person is eligible to vote only when he/she is 18 years or more
Question 3. Write an algorithm Accept a number and check: (a) whether the number is divisible by 2 and 5. (b)
whether the number is divisible by 2 but not by 5. (c) whether the number is divisible by 5 but not by 2. Display
the message accordingly
Question 5. Make a flow chart for following: First asks the user to enter a number between 1 and 10. Verify that
whether the number is between 1 and 10. Print an error message, if not so. Once verified, print the cube of the
number, if it is odd, or multiply it by 5, if it is even.
Question 6. The entire fresher’s are in campus because Covid restrictions have been removed. You all want to
make new friends so you planned a get together. You have booked a club but this club is having a restriction that
only student who is above 20 years can get the entry. Make a flowchart for taking Age as input, and check
whether the student will get the entry or not.
Bonus Question:
Robbers Problem:
In a society, N houses (a row of houses) are there, each house having N * K amount of money (e.g. first house is
having 1*K amount of money) kept inside; now there is a thief who is going to steal this money, but he has a
Flowchart and Algorithms
constraint/rule that he cannot steal/rob two adjacent houses. Find the maximum money he can rob. Values of K
and N would be taken as input and out would be the maximum money he can rob.
Test Case 1:
Input:
5
10
Output:
90
Test Case 2:
Input:
2
12
Output:
24