Practical
Practical
Input:
Output:
Q2: Write a program to accept three numbers find maximum, minimum, and middle values,
and print the ascending order.
Input:
Output:
Q3. Write a program to check whether a number entered by the user is prime.
Input:
Output:
Q4 Write the program to find the sum of n natural numbers.
Input:
Output:
Q5. Write a program to print the Fibonacci series till n terms.
Input:
Output:
Q6. Write a program that prints if the number is odd; print its cube and if it even prints its
square.
Input:
Output:
Q7. Write a program to print the sum of negative numbers, positive numbers, and sum of
positive odd numbers from the list of the numbers entered by the user and it terminates when
the number is entered to be zero.
Input:
Output:
Q8. Write a program to make a four-function calculator.
Input:
Output:
Q9. Write a program for the perimeter/circumference and area of different shapes like
squares, rectangles, and triangles.
Input:
Output:
Q10. Write a program to calculate the sum of the series x^n.
Input:
Output:
Q11. Write a program to accept the Cost Price, Sales Price, and discount percentage from the
user, and calculate the discount price. Print the profit and loss as per the computed values.
Input:
Output:
Q12.Write a program a simple and compound interest.
Input:
Output:
Q13. Write the program to print the pattern.
1
12
123
1234
12345
Input:
Output:
Q14. Write the program to print the pattern.
5
54
543
5432
54321
Input:
Output:
Q15. Write a program to print the series:- 4,-7,10………….40.
Input:
Output:
Q16. Write a program to print the pattern.
A
AB
ABC
Input:
Output:
Q18. Write a program to print the pattern.
ABCD
ABC
AB
A
Input:
Output:
Q17. Write a program to print the pattern.
1111
2222
3333
Input:
Output:
Q19. Write a program to find the maximum element, minimum element, and average of all
elements from a list of elements along with its index number.
Input:
Output:
Q20. Write a program to count the frequency of a given element in a list of the number.
Input:
Output:
Q21. Create a dictionary whose keys are month names and whose values are the number of
days in the corresponding months.
(A) Ask the user to enter a month name and use the dictionary to tell how many days in
the month.
(B) Print all the months with 31 days.
Input:
Output:
Output: