0% found this document useful (0 votes)
6 views2 pages

Arithmetic Operations Lab Manual

The document provides examples of 7 programs that take various numeric inputs and use arithmetic operators to calculate outputs. Program 1 calculates the sum of two numbers. Program 2 calculates the sum, difference, product and quotient of two numbers. Program 3 calculates the area, circumference and diameter of a circle given the radius. Program 4 calculates the square and inverse of a number. Program 5 calculates the sum and average of three numbers. Program 6 calculates the area and perimeter of a rectangle given two sides. Program 7 calculates the area and perimeter of a triangle given three sides.

Uploaded by

ahmed
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Arithmetic Operations Lab Manual

The document provides examples of 7 programs that take various numeric inputs and use arithmetic operators to calculate outputs. Program 1 calculates the sum of two numbers. Program 2 calculates the sum, difference, product and quotient of two numbers. Program 3 calculates the area, circumference and diameter of a circle given the radius. Program 4 calculates the square and inverse of a number. Program 5 calculates the sum and average of three numbers. Program 6 calculates the area and perimeter of a rectangle given two sides. Program 7 calculates the area and perimeter of a triangle given three sides.

Uploaded by

ahmed
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Lab Manual (Arithmetic Operators in calculation)

Introduction to Computing

Program#1:
Write a program that takes input of two numbers then calculate their sum and output the result.
Output:
Enter first number: 23
Enter second number: 16
Sum of 23 and 16 is 39

Program#2:
Write a program that takes input of two numbers then calculate their sum, difference, product
and quotient then output the result.
Output:
Enter first number: 13
Enter second Number: 7
Sum of 13 and 7 is: 20
Difference of 13 and 7 is: 6
Product of 13 and 7 is: 91
Dividing 13 by 7 results: 1.85714

Program#3:
Write a program that takes input for the radius of a circle then calculate its area, circumference
and diameter, then output the three results.
(Area= π r2 circumference=2πr diameter=2r)
Output:
Enter radius of circle: 13
Area of circle is: 530.92871
Diameter of circle is: 26
Circumference of circle is: 81.68134

Program#4:
Write a program that takes input of a number then calculate its square and inverse, then output
the result.
( square = x*x inverse = 1/x )
Output:
Enter a number: 18
Square of 18 is: 324
Inverse of 18 is: 0.05555
Program#5:
Write a program that takes input of three numbers, then calculate their sum and average, then
output the result.
Output:
Enter three numbers: 12
34
65
Sum of 12, 34 and 65 is 111
Average of 12, 34 and 65 is 37

Program#6:
Write a program that takes input of two sides of rectangle then calculate and print area of
rectangle.
(Area=length*width perimeter=2*( length + width ) )

Output:
Enter length of rectangle: 15.6
Enter width of rectangle: 21
Area of rectangle is: 327.6
Perimeter of rectangle is: 18.3

Program#7:
Write a program that takes input of three sides of a triangle then calculate the area of triangle.
(Area = (B*H)/2 perimeter = B+H+P)

Output:
Enter base value of triangle: 6
Enter perpendicular value of triangle: 9
Enter hypotenuse value of triangle: 8
Area of triangle is: 7
Perimeter of triangle is: 23

You might also like