
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

168 Views
This tutorial will help us in finding hyperbolic tangent of the given radian value. The hyperbolic functions are used to calculate the angles and the distances. The hyperbolic tangent function gives us the hyperbolic tangent value of the radian angle. The angle value must be a radian value. If the angle is any degree value then, it must be converted into radian value first. Syntax tanh(angle) ... Read More

257 Views
This tutorial will help us in calculating the volume of a cube. The volume of a cube is a measure of the amount of space inside the cube. It is calculated by multiplying the length of one side of the cube (s) by itself three times. The formula to calculate the volume of a cube is − V = s^3 Where V is the volume and s is the length of one side of the cube. In other words, it's the cube of the side length. Method 1: Using volumeOfCube Function In this method, the function volumeOfCube is defined ... Read More

200 Views
This tutorial will help us in calculating the area of a cube. There are various approaches to calculating the area but the mathematical formula to calculate the area will remain the same I.e., 6*(side^2). Method 1: Using cubeArea Function This example defines a function cubeArea that takes a single argument, the length of the cube's sides, and returns the area of the cube. The main function calls the cubeArea function to calculate the area. The result is then printed to the console. Algorithm Step 1 − The function cubeArea is being defined on the basis of simple mathematical formula ... Read More

629 Views
This tutorial will help us in calculating the sum of all odd numbers up to N. Haskell uses a functional programming paradigm, which means that it uses functions to transform data, rather than using loops and variables to keep track of state changes. There are different ways to calculate the sum of all odd numbers u to N in Haskell. Method 1: Using List Comprehension In this method, the function sumOddNumbers uses a list comprehension to generate a list of all odd numbers up to n, and then uses the sum function to calculate the sum of the numbers in ... Read More

633 Views
This tutorial will help us in calculating the sum of all even numbers. Haskell uses a functional programming paradigm, which means that it uses functions to transform data, rather than using loops and variables to keep track of state changes. There are different ways to calculate the sum of all even numbers between 1 and 100 in Haskell. Algorithm Step 1 − Program execution will be started from main function. The main() function has whole control of the program. It is written as main = do. Step 2 − The list comprehension [x | x

645 Views
This tutorial will help us in checking whether a variable is defined or not. In Haskell, a variable is considered defined if it has a value assigned to it. The value can be of any type, including a special type called Maybe that is used to represent values that may or may not be present. Algorithm Step 1 − The Data.Maybe module is imported. Step 2 − The checkDefined function is defined as, checkDefined x = isJust x. It takes a Maybe value and returns a Bool indicating whether the value is Just (i.e. defined) or Nothing (i.e. not ... Read More

383 Views
In Haskell, this program will help us in checking the current date against a specified birthday and prints a "Happy Birthday" message if it is a match otherwise, it will print “Not your birthday yet”. Haskell provides function to fetch the current date and also to specify a date. This program can be implemented by using various approaches including the use of toGregorian function, fromGregorian function or by using utctDay getCurrentTime. This program will only check the birthday once, when the program runs. If we want the program to check the birthday periodically or at a specific time, we ... Read More

2K+ Views
In Haskell, an enumeration (or "enum") is a type that has a finite set of values. The values are called constructors, and are usually defined using the data keyword. Here's an example of an enumeration type that represents the four seasons − data Season = Spring | Summer | Fall | Winter Enumerations are used to represent things like states, modes, or options that have a fixed set of possible values. Method 1: Iterate over enumeration type This method is used to directly iterate over the enumeration type in Haskell. Here, we define the list of all the enumeration ... Read More

559 Views
Haskell is a functional programming language and does not have a concept of inheritance. Instead, it uses type classes to achieve similar functionality. This tutorial will help us in implementing the same in Haskell. Method 1: Implement a type class that simulates multiple inheritances. This method uses type class to simulate the multiple inheritance. Here, we define two parent class and one child class. And the function of child class is being called. Once the function is being called it will take instance from both the parent class and the final output is displayed. Algorithm Step 1 − The ... Read More

260 Views
This tutorial will help us in initializing and printing a complex number. In Haskell, the Data.Complex library provides a Complex type to represent complex numbers. Method 1: Using Complex data type This method defines a Complex data type that holds the real and imaginary parts of a complex number, and an instance of the Show type class for Complex, which allows it to be printed using the putStrLn function. In the main function, it creates a complex number object with real part and imaginary part. Then it prints the complex number using the putStrLn function and the show function. Algorithm ... Read More