You are on page 1of 6

NAME: UDOFIA, EDINEN SUNDAY

DEPARTMENT: ELECTRICAL/ELECTRONICS ENGINEERING

REG NO: 19/EG/EE/1588

DATE: 15TH MARCH, 2023

COURSE CODE: CPE 311

COURSE TITLE: COMPUTER PROGRAMMING &


LANGUAGES

COURSE LECTURER: ENGR. FLORENCE ATAKPO


KINGSLEY
CPE 311-LAB ASSIGNMENT

Question 1

(1A). Write a program to print out the sum of the first 400 [positive integers.

CODE:

RESULT:

(1B). Also see how to write the program without using a loop.

CODE:
RESULT:

QUESTION 2: The range() function with one argument.

(2A). Write a program to print a list containing counting numbers from 2 to 50.

CODE:

RESULT:
(2B). Write a program to print integers from 1 to 7 all in one line.

CODE:

RESULT:

QUESTION 3:

(3A). Write a program to print numbers between 60 and 400 that are both
divisible by 3 and 4.

CODE:
RESULT:

(3B). Write a program to print sum of integers between 10 and 22.

CODE:

RESULT:

QUESTION 4:

(4A). Write a program to print even numbers between 2 and 50.

CODE:
RESULT:

(4B). Write a program to print whole numbers from 20 to 2 in descending


order.

CODE:

RESULT:

You might also like