Write a program to print all the multiples of 5 from 1 to n for a given positive integer n.
Write a program to check if a number is prime or not.(Hint: A positive number is said to be a prime number if it has precisely two distinct positive integers as factors.)
Write a program to print 2^n(n is input).
Write a program to print m^n(m ,n are inputs).
Write a program to find out the highest common factor (HCF) of two given positive integers n and m.
Write a program to print Fibonacci series up to n numbers where n will be taken as input.
Write a program to find the factorial of a given positive integer n. The factorial of a number is the product of all the integers from 1 to n.
Write program to find the value of the following expression
1+X+X^2/2!+X^3/3!+...+X^n/n! for the given values of X (float) and n (integer).
Suppose that you are assigned a task to find the maximum element in a given set of positive integers. But, you are not given the whole input at a time, and the data comes in the streaming process. Further, the data ends with a non-positive element. You are supposed to compute the maximum element that you are given until the current position. Also, you are given only two variables to store the information, one is to store the current input value, and other is to save the maximum till current input.
A banking company sends a 6-digit integer number as one-time password (OTP) to its customer mobile for all mobile banking transactions. An integer is a valid OTP if (1) it is of six-digit length and (2) contains the same number of even and odd digits. Further, the OTP does not start with 0. Write a program to read an integer and verify whether it is a valid OTP or not.
Write a program to check the given positive integer N is divisible by 3 or not. If yes, verify that N is also an even number.
Write a program to check leap year.
(Hint: A year number N is said to be a leap year in the following cases: If N is a century year (e.g., 100, 200, 300, ...) and divisible by 400, then N is a leap year. If N is a non-century year and divided by 4, then N is a leap year. In all other cases, N is a non-leap year.)
Recently, the Delhi state government did an experimental study to control air pollution. They want to observe how much of the air pollution is contributed by cars in the city. So, they came with the proposal that on Monday, Wednesday, and Friday only cars with an odd number (last four digits of the registration number) are allowed on the roads. Further, on the days, Tuesday, Thursday, and Saturday, only cars with even number are allowed on the roads of the city. On the other hand, all cars are allowed on the roads on Sunday.
Write a program to read the registration number (last four digits) and verify whether the car is allowed on roads on a particular day or not. You do not read the day of the week as part of the input.
A foreign exchange company in Delhi provides two kinds of services, conversion of Indian rupee to US dollar and vice versa, to its customers.
The charges for conversion of Indian rupee to US dollars is as follows.
(1) INR 250/- standard chares for every transaction.
(2) 1 INR = 0.0141 USD
(3) For the first INR 10,000/- rupees no extra charges will be collected, and after that for every INR 1 to INR 10,000, Rs 150/- will be collected as additional conversion charges.
(4) The minimum conversion is INR 1,000/-.
Note that you need to deduct the charges from the amount before converting into USD.
The conversion charges from US dollar to INR are as follows:
(1) The minimum conversion is 30 USD.
(2) INR 400/- standard charges for every transaction.
(3) 1 USD = 70.8305 INR
(4) For the first 50 USD, there are no extra conversion charges, after that for every 1 USD to 50 USD, Rs 300/- will be collected as additional conversion charges.
Note that the customer will get the INR after deduction of charges from the amount that he gets (i.e., amount in USD * 70.8305 - charges).
Write a program in python to incorporate the services as per the above rate list. In the first place, ask the user which transaction he/she wants to perform (USD to INR or INR to USD), then do the deal accordingly.
Sample input and output:
Use the following integers for type of service:
1 for Conversion of INR to USD
2 for Conversion of USD to INR
(1) Input : Enter the type of service (1 or 2): 1
Enter the amount in INR to convert into USD: 12500
Output: The number USD: 170.60999999999999
The charges collected: 400
(2) Input: Enter the type of service (1 or 2): 2
Enter the amount in USD to convert into INR: 120
Output: The amount in INR: 7499.66
The charges collected in INR: 1000
(3) Input: Enter the type of service (1 or 2): 4
Output: Wrong choice of service !!!!
(4) Input: Enter the type of service (1 or 2): 1
Enter the amount in INR to convert into USD: 500
Output: Minimum conversion requirement is not satisfied !!!!
A shop will give discount of 10% if the cost of purchased quantity is more than 1000. Ask user for quantity Suppose, one unit will cost 100. Judge and print total cost for user.
Take input of age of 3 people by user and determine oldest among them.
A company decided to give bonus of 5% to employee if his/her year of service is more than 5 years. Ask user for their salary and year of service and print the net bonus amount.
Write a program that accept three sides of triangle as input, and print whether the triangle is valid or not.
Hint: A triangle is valid if sum of its two sides is greater than the third side. If three sides are a, b and c, then three conditions should be met. a + b > c
Write a program to convert temperature in degrees Celsius to degrees Fahrenheit.
The formula is F = (temp * 9/5) +32 (partially solved: temp=40 ᵒC, The output should be 104 ᵒF )
Given GENDER (1 for male and 0 for female) and AGE of a person, find the discount applicable using nested if-else statements.
Write a program to display discount based on following conditions::
If the age of a male is less than or equal to 15, discount is 20 or 15 if the age is greater than 15.
If the age of a female is less than or equal to 15, discount is 30 or 25 if the age is greater than 15.
Given a character as an input, decides the arithmetic operation to be performed on the next two integers to be entered, e.g. '+' for addition, '-' for subtraction, '/' for division, and, '*' for multiplication.
Calculate and print the area of the respective figure.
Given an integer N, which represents aggregate of marks obtained by a student, find the grade according to the marks obtained(Use Ladder if-else).
if 90 <= N, grade obtained is 'A'.
if 60 <= N <= 89, grade obtained is 'B'.
if 30 <= N <= 59, grade obtained is 'C'.
if N < 30, grade obtained is 'D'.
Given a positive integer N, representing a day of the week, display the name of that weekday.
if N = 1, display "Sunday",
if N = 2, display "Monday",
if N = 3, display "Tuesday",
if N = 4, display "Wednesday",
if N = 5, display "Thursday",
if N = 6, display "Friday",
if N = 7, display "Saturday".
Given is an integer, which represents the amount as an input from the user, display the minimum number of notes $ (500, 100, 50, 20, 10, 5, 2, 1) required for the amount.
Given a coordinate point P(x, y) in an X-Y coordinate system as an input, determine in which quadrant the coordinate point lies.
print '1' if point is in 1st quadrant.
print '2' if point is in 2nd quadrant.
print '3' if point is in 3rd quadrant.
print '1' if point is in 4th quadrant.
point (0, 0) is the origin, print '0' for origin.
Display the square of even numbers and cube of all odd numbers of N integer numbers entered by the user.
The program should input N as first input.
Suppose there a sale in a store. A customer has purchased N items. There is discount of 20% on all items if sum of any number of items is 50 or more and discount is 30% on all items if sum of any number items is 100 or more. Input the cost of N items and print the discount is 0, 20 or 30.
The program should not input price for items if already discount of 30% is found for items entered so far.
Given an integer number N. Write a program to display the count of all prime and non prime numbers between 0 and N.
Passionate about coding and teaching, I publish practical tutorials on PHP, Python,
JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and
project‑oriented with real examples and source code.