Calculate Volume and Area of Sphere in C++

Arnab Chakraborty
Updated on 17-Oct-2022 12:46:21

9K+ Views

The Sphere is a ball-like 3D object whose all sides are curved surfaces. On a sphere, no plane surface is there. The volume of a sphere is actually how much space it is taking in the space. In this article, we shall cover the techniques to calculate the volume and the surface area of a sphere in C++. A sphere has one basic parameter. The radius π‘Ÿ. We will see the techniques to calculate the volume and area one by one. The volume of a Sphere To calculate the volume of a sphere, we need one input, the radius π‘Ÿ. ... Read More

Calculate Volume and Area of a Cylinder in C++

Arnab Chakraborty
Updated on 17-Oct-2022 12:39:52

9K+ Views

The cylinder is a tube-like 3D object whose base is a circle and has a certain height. The volume of a cylinder is actually how much space it is taking in the space. In this article, we shall cover a few techniques to calculate the volume and the surface area of a cylinder in C++. A cylinder has two basic parameters. The height β„Ž and the radius of its bases π‘Ÿ. The surface area of a cylinder can have two variations. Only the outer curved surface (for hollow and both side open cylinder) and area with the curved surface with ... Read More

Calculate Volume of Cube in C++

Arnab Chakraborty
Updated on 17-Oct-2022 12:34:48

4K+ Views

Cubes are the basic 3D objects which have 8 vertices, 12-edges, and 6-faces. The volume of a 3D object is how much space it is occupying in the world. In this article, we will see how we can calculate the volume of a cube by writing a C++ program. A cube has all edges of equal length. The area for each face is π‘˜2 where π‘˜ is the length of each side. As 3D objects have length, breadth, and width, so the volume of it will be π‘˜3. Let us see the algorithm and corresponding C++ implementation to find the ... Read More

Calculate Sum of All Odd Numbers Up to N in C++

Arnab Chakraborty
Updated on 17-Oct-2022 12:27:52

14K+ Views

Getting series sum is one of the simplest practicing tasks while we are learning programming and logic build up. In mathematics, there are certain ways to find sum of series present in different progressions. In programming, we generate them one by one by implementing the logics, and repeatedly add them to get the sum otherwise perform any other operation if needed. In this article we shall cover techniques to get sum of all odd numbers up to N using C++. There are two possible ways to get this sum with a little variation. Let us see these approaches one by ... Read More

Print Multiplication Table in Triangular Form using C++

Arnab Chakraborty
Updated on 17-Oct-2022 12:24:43

745 Views

To memorise the few fundamental multiplication results in tabular or graphic form, use multiplication tables. This article will cover how to produce a multiplication table in C++ that looks like a right-angled triangle. In a select few situations where a larger number of results may be easily memorised, triangular representation is effective. In this format, a table is shown row by row and column by column, with each row containing only the entries that fill that column. To solve this problem, we need basic looping statements in C++. For displaying the numbers in triangular fashion, we need nested looping to ... Read More

C++ Program to Round a Number to N Decimal Places

Arnab Chakraborty
Updated on 17-Oct-2022 12:11:09

25K+ Views

Representing numbers in outputs is an interesting and also important task while we are writing programs in any language. For integer type (short, long, or medium) type data, it is easy to express the numbers as output. For floating point numbers (float or double type), sometimes we need to round them off to certain decimal places. For example, if we want to represent 52.24568 up to three decimal places, some pre-processing needs to be done. In this article, we shall cover a few techniques to represent a floating-point number up to a certain decimal placed by rounding it off. Among ... Read More

Vertically Align Elements in a Div

AmitDiwan
Updated on 17-Oct-2022 10:04:50

6K+ Views

We can easily vertically align elements in a div using any of the following ways βˆ’ The position property The line-height property The padding property Let us see the examples one by one βˆ’ Vertically align elements in a div using the position property The position property is used in positioning an element. It can be used in conjunction with the top, right, bottom and left properties to position an element where you want it. Here are the possible values of the position property βˆ’ static βˆ’ The element box is laid out as a part of ... Read More

Remove Space Between Inline-Block Elements

AmitDiwan
Updated on 17-Oct-2022 09:46:24

732 Views

We can easily remove the space between inline-block elements. Before moving further, let us first create an HTML document and add inline-block elements with space βˆ’Example DOCTYPE html> Inline block elements li { display: inline-block; width: 150px; font-size: 18px; } li:nth-child(1) { ... Read More

Calculate Simple Interest and Compound Interest in C++

Arnab Chakraborty
Updated on 17-Oct-2022 09:22:53

26K+ Views

After calculating interest on the principal amount, simple interest is calculated by taking the principal amount, the rate of interest, and the number of years it will take to calculate interest. The formula is quite easy to understand. The power law is used to calculate compound interest by taking into account the principal amount, the rate of interest, and the period. Here, the formula is likewise not difficult. In this article, we'll talk about how to calculate simple and compound interest values and then use the C++ programming language to put this logic into practice. Simple Interest Simple interest is ... Read More

Find Area of a Parallelogram in Kotlin

AmitDiwan
Updated on 17-Oct-2022 08:57:02

294 Views

In this article, we will understand how to find the area of a parallelogram. The area of a parallelogram is calculated using the formula byΒ βˆ’ base * height Below is a demonstration of the same βˆ’ Suppose our input is βˆ’ Base: 6 Height: 8 The desired output would be βˆ’ Area of parallelogram is: 48 Algorithm Step 1 βˆ’ START. Step 2 βˆ’ Declare three values namely base, height and myResult. Step 3 βˆ’ Define the values. Step 4 βˆ’ Calculate the area using the formula by base * height and store the result. Step ... Read More

Advertisements