



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Instructions
6. Swapping Two Numbers Write a program to interchange the values of two numbers: โ Using a temporary variable. โ Without using a temporary variable. Display the values before and after swapping. Sample Input 45 60 7. Compare Two Numbers Write a program to accept two numbers and determine whether the first number is greater , second number is greater , or both numbers are equal. Sample Input 78 56 8. Number Classification Write a program to determine whether a given integer is Positive , Negative , or Zero. Sample Input
9. Even or Odd Write a program to determine whether a given integer is Even or Odd. If the number is even, also determine whether it is divisible by 4. Sample Input 48 10. Divisibility Checker Write a program to determine whether a given number is: โ Divisible by both 3 and 5 โ Divisible only by 3 โ Divisible only by 5 โ Not divisible by either Sample Input 60 11. Mathematical Operations Write a program to accept a number and display its: โ Square โ Cube โ Square Root
18. Even Numbers Between 1 and 50 Write a program to display all even numbers between 1 and 50 and count the total number of even values. 19. Odd Numbers Between 1 and 50 Write a program to display all odd numbers between 1 and 50 and calculate their sum. 20. Sum of Natural Numbers Write a program to accept a positive integer N and calculate the sum of the first N natural numbers. Sample Input 10 21. Countdown Using While Loop Write a program to display the numbers from 20 down to 1 using a while loop. 22. Number Pattern Write a program to display the following pattern. 1 12 123 1234 12345 23. Demonstration of break Statement Write a program to display numbers from 1 to 10 and terminate the loop when the value becomes 6 using the break statement. 24. Demonstration of continue Statement Write a program to display numbers from 1 to 10 while skipping the number 5 using the continue statement. 25. Membership Operator Create a list containing the following values: [12, 25, 18, 45, 60] Write a program to determine whether 25 , 60 , and 100 are present in the list using membership operators. 26. Identity Operator Write a program to create two variables with the same value and compare them using the is and is not operators. Display the results.
27. List Operations Write a program to create a list containing five numbers and display: โ Original List โ Largest Number โ Smallest Number โ Sum of Elements โ Average โ Sorted List 28. Tuple Operations
Write a program to create a tuple containing five city names and display: โ Complete Tuple โ First Element โ Last Element โ Number of Elements โ Whether a specified city is present in the tuple
29. Dictionary Operations Write a program to create a dictionary containing the following employee details: โ Employee ID โ Name โ Department โ Salary โ Experience
Display all the details and retrieve the salary using its key.
30. Set Operations Write a program to create a set containing five numbers and perform the following operations: โ Display the original set. โ Add a new element. โ Remove an existing element. โ Create another set containing {20, 30, 40}. โ Display the union of both sets. โ Display the updated set.