Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Basic arithmatic using c++

Rating
-
Sold
-
Pages
8
Grade
B
Uploaded on
01-07-2025
Written in
2024/2025

Simple and beginner-level questions covering addition, subtraction, multiplication, division, and modulus using C++. Ideal for new learners starting with programming and basic logic building.

Institution
Course

Content preview

LAB # 02: Basic Arithmetic using C++

Lab Objective:
The main objective of this lab is to introduce students to the fundamentals of basic arithmetic
operations in C++. Students will learn how to perform basic arithmetic operations such as
addition, subtraction, multiplication, and division using C++ programming. By the end of the
lab, students will gain practical experience in using variables, operators, and control structures to
implement simple arithmetic calculations.

Hardware/Software Tools:
 Hardware: Desktop/Computer
 Software Tool: MS Visual Studio 2013

Lab Description:
This lab focuses on implementing basic arithmetic operations in C++ programming. The students
will start by understanding the role of data types and variables to store numerical values and use
appropriate operators to perform basic arithmetic tasks. The lab will cover various arithmetic
operators such as addition (+), subtraction (-), multiplication (*), and division (/). Finally, the
students will use input/output functions to display the results clearly and in a user-friendly
format, reinforcing their skills in coding and debugging C++ programs.

Arithmetic Operators:

Arithmetic operations are performed using operators that allow you to manipulate numbers in
various ways. These operations include addition, subtraction, multiplication, and division. When
writing a program, you can use the arithmetic operators +, -, *, and / to carry out these
calculations. For example, the addition operator + adds two numbers together, the subtraction
operator - subtracts one number from another, the multiplication operator * multiplies two
numbers, and the division operator / divides one number by another.

Command Name Example Output

+ Addition 4+5 9

- Subtraction 8-5 3

* Multiplication 4*5 20

/ Division 19/3 6

% Remainder 19%3 5




1

, 1. Addition (+): The addition operator is used to add two values together. For example:




This example/code defines two integer variables, a and b, with values 5 and 3,
respectively. It then adds them together, stores the result in the variable result, and
displays the sum to the console.



2. Subtraction (-): The subtraction operator is used to subtract one value from another. For
example:




This code/example defines two integer variables, a and b, with values 5 and 3,
respectively. It then subtracts b from a, stores the result in the variable result, and
displays the difference to the console.




2

Written for

Course

Document information

Uploaded on
July 1, 2025
Number of pages
8
Written in
2024/2025
Type
Exam (elaborations)
Contains
Only questions

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
hadiqagulzar

Get to know the seller

Seller avatar
hadiqagulzar NUST College of Electrical & Mechacical Engineering
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
9 months
Number of followers
0
Documents
9
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions