You are on page 1of 8

ACTUAL

ACTIVITY 2.1
COMPUTER PROGRAMMING

RENMARK D. MARTINEZ
CE-1201
1. Write a Python program to check whether a number is divisible by 5 and 11 or not
using if else. How to check divisibility of any number in Python programming.
Python program to enter any number and check whether it is divisible by 5 and 11
or not. Logic to check divisibility of a number in a Python program.

Sample Output 1:
Let us check if your number is divisible by 5 and 11:
----------------------------------------------------------------
Input a number: 55
Output
Number is divisible by 5 and 11.

Sample Output 2:
Let us check if your number is divisible by 5 and 11:
----------------------------------------------------------------
Input a number: 44
Output
Number is not divisible by 5 and 11.
PROGRAM CODE AND OUTPUT SCREENSHOTS
PROGRAM CODE:

#Renmark D. Martinez
#CE-1201
#Actual Activity 2

x=int(input("Input a number: "))

if x%5==0 and x%11==0:


print("The number is divisible by 5 and 11.")
else:
print("The number is not divisible by 5 and 11.")
2. Write a program that determines a student's final grade. The program will read
three types of score(exercise, mid-term and final score) and determine the grade based
on the following rules. Use nested if statement or if-elif-else statement.

-if the average score is greater or equal to 90% then final grade=A

if the average score greater than or equal to70% and less than 90% then final grade=B

if the average score greater than or equal to 50% and less than 70% then final grade=C

if the average score less than 50% then final grade=F

Sample Output 1:

Let us check your Final Grade:

-----------------------------------------

Enter your exercise score:90

Enter your midterm score: 90

Enter your final score: 93

Your final average is : 91%

Remarks:

Final Grade is: A

Sample Output 2:

Let us check your Final Grade:

-----------------------------------------

Enter your exercise score:75

Enter your midterm score: 78


Enter your final score: 89

Your final average is : 80.67%

Remarks:

Final Grade is: B

Sample Output 3:

Let us check your Final Grade:

-----------------------------------------

Enter your exercise score:65

Enter your midterm score: 68

Enter your final score: 70

Your final average is : 67.67%

Remarks:

Final Grade is: C

Sample Output 4:

Let us check your Final Grade:

-----------------------------------------

Enter your exercise score:48

Enter your midterm score: 47

Enter your final score: 46

Your final average is : 47%


Remarks:

Final Grade is: F

PROGRAM CODE AND OUTPUT SCREENSHOTS:


PROGRAM CODE:

#Renmark D. Martinez
#CE-1201
#Actual Activity 2

m=int(input("Enter your exercise score:"))


n=int(input("Enter your midterm score:"))
o=int(input("Enter your final score:"))
p=m+n+o
q=round(p/3, 2)

print("Your final average is", q,"%")

if q>=90:
print("\n\nRemarks:\nYour final grade is: A")
else:
if q>=70 or q<90:
print("\n\nRemarks:\nYour final grade is: B")
else:
if q>=50 or q<70:
print("\n\nRemarks:\nYour final grade is: C")
else:
print("\n\nRemarks:\nYour final grade is: F")

You might also like