Server Side Programming Articles

Page 1679 of 2109

Haskell Program to calculate the volume and area of Cone

Akhil Sharma
Akhil Sharma
Updated on 23-Jan-2023 323 Views

This tutorial will help us in calculating the volume and area of the Cone. The volume of a cone is a measure of the amount of space inside the cone. And area involves the surface area of the cone that is obtained from the lateral area of a cone. The formula for the volume of a cone is V = (1/3) * π * r^2 * h, where r is the radius of the base of the cone, h is the height of the cone, and π is approximately equal to 3.14. And the formula for the surface area of ...

Read More

Haskell Program to calculate the volume, diagonal, and area of Cuboids

Akhil Sharma
Akhil Sharma
Updated on 23-Jan-2023 394 Views

This tutorial will help us in calculating the volume, diagonal, and area of the Cuboids. The volume of a cuboid is a measure of the amount of space inside the cuboid. And area involves the surface area of the cuboid. The diagonal of a cuboid is a line segment connecting two opposite vertices of the cuboid. It is also known as the "space diagonal" or "body diagonal" of the cuboid. Algorithm Step 1 − The volume, diagonal and area functions are defined on the basis of simple mathematical formula as volume l w h = l * w ...

Read More

Haskell Program to calculate the volume and area of the Cylinder

Akhil Sharma
Akhil Sharma
Updated on 23-Jan-2023 377 Views

This tutorial will help us in calculating the volume and area of the Cylinder. The volume of a cylinder is a measure of the amount of space inside the cylinder. The area involves the surface area of the cylinder. The formula for the volume of a cylinder is the product of the base area of the cylinder, which is given by πr^2 and the height h. The formula for the surface area of a cylinder is the sum of the areas of the two circular faces and the area of the rectangular lateral surface. Algorithm Step 1 − The ...

Read More

How does tuple destructuring work in TypeScript?

Shubham Vora
Shubham Vora
Updated on 20-Jan-2023 2K+ Views

In TypeScript, a tuple is an object which contains the values of different data types. The length of a tuple is always pre-defined. It is similar to an array, but the array contains the values of only one data type, and the tuple contains values of multiple data types. Destructuring the tuple means getting the values from the tuple in separate variables. For example, we need to use tuple values multiple times in the code block. We can get all values in separate variables and use variables whenever we require tuple values, rather than every time accessing values from tuple ...

Read More

How to make object properties immutable in TypeScript?

Shubham Vora
Shubham Vora
Updated on 20-Jan-2023 3K+ Views

The simple definition of the immutable object property is the properties we can’t modify once we define and initialize the object property. We can use the const keyword, but we have to initialize the property while creating the property. So, we have to use the readonly keyword to make the property immutable, allowing it to be read-only. So, once we initialize the property, we can’t modify the value of the property. Syntax Users can follow the syntax below to use the readonly keyword to make object properties immutable. interface test { readonly property1: boolean; } var object: ...

Read More

How to create a stack in TypeScript using an array?

Shubham Vora
Shubham Vora
Updated on 20-Jan-2023 3K+ Views

The stack is a data structure based on the LIFO, which means last in, first out. In brief, it says that whatever element you add at last in the stack comes out first from the stack. There are some basic operations that users can perform on the stack. For example, we can push an element to the stack, pop an element from the stack, or peek an element from the stack. Here, users can see the basic methods of the stack, which we will also implement while creating the stack in this tutorial. Stack Methods Push() − It allows ...

Read More

How to create a queue in TypeScript using an array?

Shubham Vora
Shubham Vora
Updated on 20-Jan-2023 3K+ Views

We will learn to create a queue from scratch using the array in TypeScript in this tutorial. The Queue is a data structure allowing users to add elements from the end and remove them from the start. It means it works based on the FIFO concept, meaning first in, first out. Also, we can’t remove the element randomly from the queue like an array. We can only remove elements from the first index and add them to the last empty index. Here, we will use some concepts of object-oriented programming language to create a queue using an array. Methods of ...

Read More

Tackling recursion (not just) in Typescript

Shubham Vora
Shubham Vora
Updated on 20-Jan-2023 4K+ Views

Recursion is a fundamental programming concept that refers to a function calling itself. It can be a powerful tool for solving problems, but it can also be a source of confusion and frustration, especially for beginners. In this tutorial, we'll explore how to use recursion effectively in TypeScript, a popular superset of JavaScript that adds optional static typing and other features. One important thing to keep in mind when working with recursion is to define a base case, which is a condition that stops the function from calling itself again. Without a base case, the function will keep calling itself ...

Read More

How to create function overload in TypeScript?

Shubham Vora
Shubham Vora
Updated on 20-Jan-2023 1K+ Views

The function or method overloading allows developers to create multiple functions with the same name. Every function contains the same number of parameters but different data types. Also, the return type of the overloaded function can vary. Function overloading is the concept of object-oriented programming. Also, TypeScript supports OOPS, so we can easily implement function overloading in TypeScript. Furthermore, function overloading provides code reusability and helps developers to increase code readability. Let’s understand the use of function overloading via real-life examples. For example, you have created a function that takes a string as a parameter and returns the length of ...

Read More

Haskell Program to find the arccosine of the given value

Akhil Sharma
Akhil Sharma
Updated on 20-Jan-2023 348 Views

This tutorial will help us in finding arccosine of the given value. The arccosine is the inverse function of the cosine. If given a value between -1 and 1, it returns the angle (in radians) whose cosine is equal to that value. For example, the cosine of pi/3 radians is equal to 0.5. Therefore, if you pass 0.5 as an input to the arccosine function, it should return pi/3 radians. Syntax acos(angle) Here, acos() is a built-in function and value is passed as parameter to compute the arccosine of the value passed. Method 1: Finding arccosine using in-built ...

Read More
Showing 16781–16790 of 21,090 articles
Advertisements