Arithmetic Operators 45 Questions
Arithmetic Operators 45 Questions
10. Write a Python program to swap two numbers using a temporary variable.
11. Write a Python program to swap two numbers without using a temporary variable.
16. Write a Python program to convert minutes to hours and minutes using division and modulo.
18. Write a Python program to calculate the percentage of marks from total marks.
23. Write a Python program to find the maximum of three numbers using arithmetic and logical
operators.
25. Write a Python program to check if a year is a leap year using arithmetic operators.
26. Write a Python program to calculate the sum of the first n natural numbers.
27. Write a Python program to calculate the sum of the squares of first n natural numbers.
28. Write a Python program to calculate the sum of the cubes of first n natural numbers.
29. Write a Python program to find the sum of digits of a number using arithmetic operators.
31. Write a Python program to check if a number is a palindrome using arithmetic operators.
33. Write a Python program to calculate the factorial of a number using arithmetic operators.
34. Write a Python program to calculate the greatest common divisor (GCD) of two numbers.
35. Write a Python program to calculate the least common multiple (LCM) of two numbers.
36. Write a Python program to find the power of a number without using the built-in power operator.
37. Write a Python program to convert a binary number to decimal using arithmetic.
38. Write a Python program to convert a decimal number to binary using arithmetic.
39. Write a Python program to find all prime numbers up to a given number using arithmetic
operations.
43. Write a Python program to evaluate a complex arithmetic expression entered by the user.
44. Write a Python program to simulate a simple calculator (addition, subtraction, multiplication,
division).
45. Write a Python program to solve simultaneous equations using arithmetic operators.