JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

15 Programs | JustPaste.app
21 days ago7 views
👨‍💻Programming

15 Programs

# Program 1
# Write a program to input your name and print a welcome message as "Welcome, Mr. <name>".
name = input("Input your name: ")
print("Welcome, Mr.", name)

# Program 2
# Write a program to input 4 numbers and print their sum.
a = float(input("Input a number [1/4]: "))
b = float(input("Input a number [2/4]: "))
c = float(input("Input a number [3/4]: "))
d = float(input("Input a number [4/4]: "))
print(a + b + c + d)

# Program 3
# Write a program to input three numbers and print their product.
a = float(input("Input a number [1/3]: "))
b = float(input("Input a number [2/3]: "))
c = float(input("Input a number [3/3]: "))
print(a * b * c)

# Program 4
# Write a program to input an integer and print two of its adjacent numbers,
# e.g. if you input 7, the program should print 6 and 8.
n = int(input("Input a number: "))
print(n - 1, n + 1)

# Program 5
# Write a program to input a number and print the product of the input number
# with two of its next numbers (i.e. n, n + 1 and n + 2).
n = int(input("Input a number: "))
print(n * (n + 1) * (n + 2))

# Program 6
# Write a program to input time in minutes and print it in seconds.
mins = int(input("Input an amount of minutes: "))
secs = mins * 60
print(mins, "mins =", secs, "seconds")

# Program 7
# Write a program to input base and height of a triangle and print its area
# as 1/2 * base * height.
b = float(input("Input the base of a triangle: "))
h = float(input("Input the height of a triangle: "))
print("Area =", 0.5 * b * h)

# Program 8
# Write a program to input a number and print its square.
n = int(input("Input a number: "))
print(n, "squared =", n ** 2)

# Program 9
# Write a program to input a number and print its cube.
n = int(input("Input a number: "))
print(n, "cubed =", n ** 3)

# Program 10
# White a program to input two numbers and print their remainder.
a = int(input("Input an integer [1/2]: "))
b = int(input("Input an integer [2/2]: "))
print(a, "mod", b, "=", a % b)

# Program 11
# Write a program to input age in years and print in days.
years = float(input("Input your age in years: "))
days = years * 365.2425  # There are approximately 365.2425 days in a year
print("You are", days, "days old")

# Program 12
# Write a program to input age in years and print in months.
years = float(input("Input your age in years: "))
months = years * 12
print("You are", months, "months old")

# Program 13
# Write a program to input two numbers a and b and print a ** b.
a = int(input("Input an integer [1/2]: "))
b = int(input("Input an integer [2/2]: "))
print(a, "**", b, "=", a ** b)

# Programs 14 and 15
# Write a program to input length and breadth of a rectangle and print its
# area and perimeter.
l = int(input("Input the length of a rectangle: "))
b = int(input("Input the breadth of a rectangle: "))
print("Area =", l * b)
print("Perimeter =", 2 * (l + b))
← Back to timeline