Professional Documents
Culture Documents
Lab 2 - Arithmetic Statement
Lab 2 - Arithmetic Statement
Lab 2 - Arithmetic Statement
Lab Rules
❖ No copying of coding.
❖ Only 30% plagiarism is allowed (more than 30% results to a zero mark in that lab).
❖ Individual or Pair Submission (lab supervisor will inform)
❖ Marks will be given for correct comments, concise coding, correct use of commands and
should have an appealing structure.
Introduction
The arithmetic statements are the ADD, MODULUS, DIVIDE, MULTIPLY and SUBTRACT statements.
Objectives
The objective of this lab is to understand and practice working with arithmetic statements in C++.
Participants will gain hands-on experience with basic arithmetic operations and expressions.
Lab Exercises
- Addition
- Subtraction
- Modulus
- Multiplication
- Division
Your program must prompt the user to enter 2 numbers and then the result of each operation must
be printed out.
According to the coulomb force law, the electric force between charged particles of charge 𝑄1 and 𝑄2
coulombs, that are a distance, r, meter apart, is given by the following formula.
𝑄1 𝑄2
F=
4𝜋𝜀𝑟 2
Where 𝜀 = 8.854 𝑥 10−12 farads/meter.
Page 1 of 2
EED420 Computer Systems
Write a program that calculates the force on a pair of charged particles, based on the user input 𝑄1
coulombs and 𝑄2 coulombs, and r meters, and then computes and displays the electric force.
- Calculates the total resistance of the circuit (user must be prompted for the values of R1,R2
and R3)
- Given the value of V is 36V, calculate the voltage drop at R3.
Page 2 of 2