Write a program to get Principal, Rate, Time and calculate Simple and Compound interest.
[Hint: SI=P*R*t/100 and CI=P+SI]
Write a program to check whether a person can vote or not.
[Hint: If age is greater than or equal to 18 then the person is eligible to vote.]
Write a program to input the day number and display the name of the week day using Switch.
[Hint: No. inputted by the user:1, It’s Monday]
Write a program to check greatest of 3 numbers.
Write a program to display reverse counting from 100 to1.
Write a program to get a number from the user and check whether it’s an even or odd
Answers
Answer:
Hey these are in python...
# SIMPLE INTEREST
p = float(input("Enter principal: "))
t = float(input("Enter time: "))
r = float(input("Enter rate of interest: "))
si = (p*t*r)/100
ci = p+si
print("Simple Interest = ", si)
print("Compound Interest = ", ci)
# PERSON CAN VOTE OR NOT
age = int(input("Enter age: "))
if age<18:
print(f"Person of age {age} cannot vote")
else:
print(f"Person of age {age} can vote")
# Displaying week day (JavaScript)
let num = +prompt("Enter week day number")
switch(num){
default:
console.log('Sunday')
break
case 1:
console.log('Monday')
break
case 2:
console.log('Tuesday')
break
case 3:
console.log('Wednesday')
break
case 4:
console.log('Thursday')
break
case 5:
console.log('Friday')
break
case 6:
console.log('Saturday')
break
}
# GREATEST OF THREE NUMBERS
nums = []
for i in range(3):
num = float(input("Enter a number: "))
nums.append(num)
print("The greatest number = ", max(nums))
# REVERSE NUMBERS FROM 100 TO 1
nums = []
for i in range(1, 101, -1):
nums.append(i)
nums.reverse()
print(nums)
# EVEN OR ODD
num = int(input("Enter a number: "))
if num%2 == 0:
print(num, "is an even number")
else:
print(num, "is an odd number")
# HOPE THIS HELPS!!