0% found this document useful (0 votes)
8 views2 pages

Algorithm n Python WS

The document contains algorithms and Python programs for basic numerical operations. It includes algorithms to check if a number is positive or negative, calculate the sum and average of ten numbers using loops. The content is structured for an 8th-grade computer subject worksheet.

Uploaded by

yushaasifkhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Algorithm n Python WS

The document contains algorithms and Python programs for basic numerical operations. It includes algorithms to check if a number is positive or negative, calculate the sum and average of ten numbers using loops. The content is structured for an 8th-grade computer subject worksheet.

Uploaded by

yushaasifkhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

New Middle East International School

Name Yusha asif khan Semester II


Grade 8 Worksheet No. 2
Date 20/1/25 Subject Computer
Topic Algorithms

1) Write an algorithm to check if the given number is positive number. (Simple IF Statement)

OUTPUT “Enter any number”


INPUT Num
IF Num >0 THEN
OUTPUT “Positive Number”
ENDIF

2) Write an algorithm to check if the given number is positive number or negative number. (Composite IF
Statement)

OUTPUT “Enter any number”


INPUT Num
IF Num >0 THEN
OUTPUT “Positive Number”
ELSE
OUTPUT “Negative Number”
ENDIF

3) Write an algorithm to calculate the sum of 10 numbers. (FOR Loop)

Sum  0
FOR Count  1 TO 10
OUTPUT “Enter any number”
INPUT Num
Sum Sum + Num
NEXT Count
OUTPUT “Sum of 10 numbers”
OUTPUT Sum

4) Write an algorithm to calculate the average of 10 numbers. (FOR Loop)

Sum  0
FOR Count  1 TO 10
OUTPUT “Enter any number”
INPUT Num
Sum Sum + Num
NEXT Count
Avg  Sum/10
OUTPUT “Average of 10 numbers”
OUTPUT Avg
New Middle East International School
Name Semester II
Grade 8 Worksheet No. 3
Date Subject Computer
Topic Python programing

1) Write a program to check if the given number is positive number. (Simple IF Statement)
Num = int(input("Enter any number "))
if Num > 0 :
print("Positive Number")

2) Write a program to check if the given number is positive number or negative number. (Composite IF
Statement)

Num = int(input("Enter any number "))


if Num > 0 :
print("Positive Number")
else:
print("Negative Number")

3) Write a program to calculate the sum of 10 numbers. (FOR Loop)

Sum = 0
for Count in range(0,10):
Num = int(input("Enter any number"))
Sum = Sum + Num
print("Sum of 10 numbers")
print(Sum)

4) Write a program to calculate the average of 10 numbers. (FOR Loop)


Sum = 0
for Count in range(0,10):
Num = int(input("Enter any number"))
Sum = Sum + Num
Avg = Sum/10
print("Average of 10 numbers")
print(Avg)

You might also like