In Haskell, we can list comprehension, filter function and recursion to display factors of a number. In the first example we are going to use (factors n = [x | x n `mod` x == 0) [1..n]) function. And in third example, we are going to use recursion with base and recursive case. Algorithm Step 1 − The user-defined factors function is defined using internal functions. Step 2 − Program execution will be started from main function. The main() function has whole control of the program. It is written as main = do. Step 3 − The variable ... Read More
Haskell has functions like higher order and filter, that can be used for getting the Armstrong number between two given internvals. In the first example we are going to use (isArmstrong and armstrongInRange function with higher order) and in the second example, we are going to use (filter isArmstrong [a..b]) function. Algorithm Step 1 − The user-defined isArmstrong function is defined. Step 2 − Program execution will be started from main function. The main() function has whole control of the program. It is written as main = do. Step 3 − The variables named, “lower” and “upper” are ... Read More
Haskell has internal functions like divMod, mod and properFraction to get the remainder of the float number. In the first example we are going to use (divMod' (x) (y)) function and in the second example, we are going to use (mod' x y) function. And in third example, we are going to use (properFraction $ x / y) function. Algorithm Step 1 − The Data.Fixed module is imported to use divMod function. Step 2 − The variables named, “x” and “y” are being initialized. It will hold the floating point numbers whose remainder value is to be found ... Read More
A very efficient strategy to expand your business is to stay one step ahead of the competition. The key to influencing and attracting clients is to thoroughly understand your competition and identify strategies to outperform them. Every digital marketing strategy should include a competitive analysis of the online market. Understanding the digital methods of your rivals enables you to improve on their advantages, lessen disadvantages, and expand. And you can achieve this without the assistance of a costly third party. If you know how everything can be accomplished inside. Your rivals can teach you a thing or two. yes! Although ... Read More
Haskell has internal functions like negate, abs and signum functions that can be used to get magnitude of the given number. In the first example we are going to use (negate n) function and in the second example, we are going to use (abs) function. In third example, we are going to use (signum x) function. Algorithm Step 1 − Define the magnitude function Step 2 − Program execution will be started from main function. The main() function has whole control of the program. Step 3 − The variable named, “num” is being initialized. It will hold the number ... Read More
Regardless of the organization, each marketing effort is distinct. Traditional marketing and digital marketing are significantly dissimilar. It's crucial to comprehend the similarities and distinctions between digital and traditional campaigns in order to avoid adopting traditional marketing assessment methodologies to digital marketing. Therefore, it's a good idea to create your campaign goals and evaluate the possible performance of your marketing campaign before spending money on launching any digital marketing campaign. Before spending money on your next marketing effort, spending a little time planning and analyzing it can pay off greatly. Your marketing initiatives can be more effective and of ... Read More
In Haskell, we can use denominator, div, quot and gcd functions to obtain the denominator from a rational number. In the first example we are going to use (denominator r) function and in the second example, we are going to use (d `div` gcd n d) function. Algorithm Step 1 − The Data.Ratio module is imported to use denominator function. Step 2 − Program execution will be started from main function. The main() function has whole control of the program. It is written as main = do. It calls the denominator function with the rational number and prints ... Read More
In Haskell, we will convert boolean variables into string by using user-defined function, boolToString along with if-else statement and pattern matching. In the first example, we are going to use (boolToString b = show b) function and in the second example, we are going to use (boolToString b = if b then "yes" else "no"). And in third example, we are going to use pattern matching. Algorithm Step 1 − Define the boolToString function Step 2 − The program execution will be started from main function. The main() function has whole control of the program. It is written as ... Read More
In Haskell, we can use internal functions like fromIntegral intToLong and toInteger function and toEnum to convert int type variable to long. In the first example, we are going to use (let longVar = fromIntegral intVar :: Int64) and in the second example, we are going to use (intToLong = toEnum) function. Algorithm Step 1 − The Data.Int module is imported. Step 2 − The program execution will be started from main function. The main() function has whole control of the program. Step 3 − The variable named, “intVar” is being initialized. It will hold the Int type variable ... Read More
In Haskell, we can use fromIntegral function along with toInteger and truncate function, div and mod functions to convert long type variable into int. In the first example, we are going to use ( let intVar = fromIntegral longVar :: Int) and in the second example, we are going to use (let highPart = fromIntegral (longVar `div` 2^32) :: Int and let lowPart = fromIntegral (longVar `mod` 2^32) :: Int). Algorithm Step 1 − The program execution will be started from main function. The main() function has whole control of the program. It is written as main ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP