Lab External Ans
Lab External Ans
by user.
A) Flowchart:
Algorithm:
Procedure:
Start
Step-1: Read two values from user into the variables a and b.
Q2) Draw a flowchart and design an algorithm to compute factorial of any number entered
by
user.
A) Flowchart:
Algorithm
Input: A number
Procedure:
Step 1: Start
Step 2: initialize variable count to 1
Step 6: End
Q3) Develop an algorithm and flowchart to reverse the digits of an integer entered by user.
A) Flowchart:
Algorithm:
Input: 1 number.
Procedure:
Start
Step-3.1: r=n%10
Step-3.2: s=s*10+r
Step-3.3: n=floor(n/10)
End
Q4) Develop an algorithm and flowchart to compute the greatest common divisor of two
given integers.
A) Flowchart:
Algorithm:
Procedure:
Start
Step-1: Read two integer values from user into variable n1 and n2.
Step-2: If n1<n2
Least=n1
Else:
Least=n2
gcd=x
End
Q5) Develop a python program to check whether given year is leap year or not.
Q6) Design a python program that prints numbers from “start” to “end” using while loop,
where “start” and “end” values are entered by user.
A)
Q7) Write a python program that prints multiplication table of any number entered by
user.
A)
A)
Q10) Develop a python program that processes a paragraph of text, counting the number
of words, finding the longest word, and converting the text to title case.
A)
Q11) Design a python program to implement bubble sort algorithm that sorts a list of item
A)
Q12) Design a python program to implement selection sort algorithm that sorts a list of
item quantities entered by the user.
A)
Q13) Perform set operations union,intersection and difference with the help of a python
program.
A)
Q14)Create a python program to generate list of squares of even numbers between 1,20.
A)
A)
Q16)Develop a program to demonstrate how to (i) add and remove elements from
a list (ii) accessing elements in tuple.
A)
A)