You are on page 1of 13

PROGRAM 1:

WRITE A PROGRAM TO INPUT WELCOME MESSAGE AND DISPLAY IT

CODE:

OUTPUT:

PROGRAM 2: Input two numbers and display the larger number.

CODE:
OUTPUT:

PROGRAM 3: Input two numbers and display the smallest number.

CODE:

OUTPUT:

PROGRAM 4: Input three numbers and display the largest number.

CODE:
OUTPUT :

PROGRAM 5: Given two integers x and n, compute 𝑥︎ n

CODE:

Python

OUTPUT:
PROGRAM 6: Write a program to input the value of x and n and print the sum of the
following series
1+x+x2+x3+x4+ …………xn

CODE:

OUTPUT:

PROGRAM 7: Determine whether a number is a perfect number or not

CODE:
OUTPUT:

PROGRAM 8: Write a program to find sum of digits in a number

CODE:

OUTPUT:

PROGRAM 9: Determine whether a number is a Armstrong number or not

CODE:

OUTPUT:
PROGRAM 10: Input a number and check if the number is a prime or composite number.

CODE:
OUTPUT:

PROGRAM 11: Compute the greatest common divisor of two integers

CODE:

OUTPUT:
PROGRAM 12: Find the largest number in a list

CODE:

OUTPUT:
PROGRAM 13: Find the Smallest number in a list

CODE:

OUTPUT:

You might also like