You are on page 1of 1

KINGDOM OF SAUDI ARABIA

MINISTRY OF HIGHER EDUCATION ‫المملكة العربية السعودية‬


AL-IMAM MUHAMMAD IBN SAUD ISLAMIC ‫وزارة التعليم العالي‬
UNIVERSITY
‫جامعة المام محمد بن سعود السلمية‬
COLLEGE OF COMPUTER AND
INFORMATION SCIENCES ‫كلية علوم الحاسب والمعلومات‬

Department: Computer Science Course: Computer Programming 1 (CS140)


Sections: all sections Allowed Time: 1h40

Lab 1 (1 page, 6 Exercises)


Exercise 1
Write a C++ program that outputs on the screen the following text:
Welcome to the CS140 ''Computer Programming 1'' Lab.

Exercise 2
Write a C++ program that outputs on the screen the following patterns:
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************

Exercise 3
Write a C++ program that computes the sum of the different grades (Labs, Midterms, Final)
obtained in the CS140 course for a given student. The program should ask the user to enter the
grade for each evaluation. You should stick to the following output.
Lab 1 (0 - 10): 6
Lab 2 (0 - 10): 7.5
Midterm 1 (0 - 20): 16.5
Midterm 2 (0 - 20): 18.5
Final (0 - 40) : 26.5
Sum = 75

Exercise 4
Write a C++ program determines whether a number n given by the user is even or odd.

Exercise 5
Write a C++ program determines whether a number n given by the user is a multiple of 3 or not.

Exercise 6
Write a C++ program that determines the maximum of 3 numbers a, b, and c given by the user.

You might also like