You are on page 1of 1

Yarmouk University 

Hijjawi Faculty for Engineering Technology 


Computer Engineering Department 
CPE 150: Introduction to Programming Laboratory  
Task 02: cin/cout Statements, and Arithmetic Operators 

Required Tasks: 

1. Write  a  program  that  reads  three  integers  from  the  keyboard,  and  prints  the  sum,  average  and 
product of these numbers. The screen dialogue should appear as follows: 
 

 
 

2. When  an  object  is  falling  because  of  gravity,  the  following  formula  can  be  used  to  determine 
the distance the object falls in a specific time period: 
d = (1/2) * g * t​2  
 
The variables in the formula are as follows:  
● d is the distance in meters,  
● g is 9.8, and t is the amount of time, in seconds, that the object has been falling. 
Write a program that reads in the time and prints out the distance. 

3. Write  a  program  that  inputs  a  three-digit  number,  separates  the  number  into  its  individual 
digits and prints the digits separated from one another by a space. 
 

 
 
 
Postlab Exercise 
 
1.   Write  an  ​opposite  program  ​of  question  3;  a  program  which  asks  the  user  for  three 
one-digit numbers and combines them into a single three-digit number. 
 
2. Write  a  C++  program  that  reads  three  integer  numbers  from  the  keyboard  and  find  the 
middle number among the three numbers. Assume that all three numbers are different. 

You might also like