Computer Assignment2
Computer Assignment2
Input:
If number <= 1:
Else:
I=2
Is_prime = True
While I * I <= number: # Check divisors up to the square root of the number
If number % I == 0:
Is_prime = False
Break
I += 1
If is_prime:
Else:
Output:
Enter a number: 19
19 is a prime number.
Input:
If number <= 1:
Else:
I=2
Is_prime = True
While I * I <= number: # Check divisors up to the square root of the number
If number % I == 0:
Is_prime = False
Break
I += 1
If is_prime:
Else:
Output:
Enter a number: 30
Input:
# Initialize counter
I=1
I += 1
Output:
Multiplication Table of 7:
7x1=7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70
Input:
# Initialize counter
I=1
I += 1
Output:
13 x 1 = 13
13 x 2 = 26
13 x 3 = 39
13 x 4 = 52
13 x 5 = 65
13 x 6 = 78
13 x 7 = 91
13 x 8 = 104
13 x 9 = 117
13 x 10 = 130
Input:
# Initialize counter
I=1
I += 1
Output:
Square of 1 = 1
Square of 2 = 4
Square of 3 = 9
Square of 4 = 16
Square of 5 = 25
Square of 6 = 36
Square of 7 = 49
Square of 8 = 64
Square of 9 = 81
Square of 10 = 100