Potti Chandra Sekhar sai

Potti Chandra Sekhar sai

33 Articles Published

Articles by Potti Chandra Sekhar sai

Page 2 of 4

Haskell Program to Calculate the Power of a Number

Potti Chandra Sekhar sai
Potti Chandra Sekhar sai
Updated on 14-Dec-2022 1K+ Views

This tutorial discusses writing a program to calculate the power of a number in the Haskell programming language. The nth power of a number is the value when the number is multiplied by itself n times. The power of numbers can be expressed in exponential forms “a^n”, a is raised to the power of n. Here a is called the base and n is called an exponent. For example, 2 raised to the power of 5 is 2^5 i.e 32. In this tutorial, we see different ways to implement a program to calculate the power of a number. Program ...

Read More

Haskell Program to Count Number of Digits in an Integer

Potti Chandra Sekhar sai
Potti Chandra Sekhar sai
Updated on 14-Dec-2022 1K+ Views

In this tutorial, we discuss writing a program to count the number of digits in an integer in the Haskell programming language. In this tutorial, we see three ways to implement a program to count digits in Haskell. Program to count the number of digits in an integer. Program to count the number of digits in an integer using if-else.Program to count the number of digits in an integer using the length function. Algorithmic Steps Take input or initialize a variable for an integer. Implement the program logic to count the digits in an integer. Print or display ...

Read More

Haskell Program to Reverse a Number

Potti Chandra Sekhar sai
Potti Chandra Sekhar sai
Updated on 14-Dec-2022 927 Views

This tutorial discusses writing a program to reverse a number in the Haskell programming language. In this tutorial, we see two ways to implement a program in Haskell to reverse a number. Program to reverse a number using the list function reverse. Program to reverse a number using a recursive function. Example 1 Program to reverse a number using the list function reverse. -- function declaration reverseNumber :: Int->Int -- function definition reverseNumber n = k where temp = reverse (show n) ...

Read More

Haskell Program to Find the Area of a parallelogram

Potti Chandra Sekhar sai
Potti Chandra Sekhar sai
Updated on 14-Dec-2022 313 Views

This tutorial discusses writing a program to print the area of a parallelogram in the Haskell programming language. A parallelogram is a quadrilateral with opposite sides that have the same size and are parallel to each other. In this tutorial, We see three ways to implement Program to compute the area of a parallelogram using height and base. Program to compute the area of a parallelogram using sides. Program to compute the area of a parallelogram using the diagonals. Algorithm Steps Take input or initialize the variable for the size of the parallelogram. Implement the program ...

Read More

Haskell Program to Find the Area of a Rectangle

Potti Chandra Sekhar sai
Potti Chandra Sekhar sai
Updated on 14-Dec-2022 626 Views

This tutorial discusses writing a program to print the area of a rectangle in the Haskell programming language. The rectangle is a quadrilateral with opposite sides having the same length and adjacent sides at right angles. The area of a rectangle is equal to its product of length and breadth. If the length and breadth of the rectangle are 5 and 6 respectively, then the area of that is 30 units(5*6). In this tutorial, We see four ways to implement Program to compute the area of a rectangle using the infix operator “*”. Program to compute the area ...

Read More

Haskell Program to Generate Multiplication Table

Potti Chandra Sekhar sai
Potti Chandra Sekhar sai
Updated on 24-Nov-2022 444 Views

In this tutorial, we discuss writing a program to generate a multiplication table in the Haskell programming language. ExampleMultiplication table of 12 up to 10 is 12 * 1 = 12 12 * 2 = 24 12 * 3 = 36 12 * 4 = 48 12 * 5 = 60 12 * 6 = 72 12 * 7 = 84 12 * 8 = 96 12 * 9 = 108 12 * 10 = 120 In this tutorial, we see Program to generate a multiplication table of a number up to the constant range of 10. (Tail ...

Read More

Haskell Program to Sort Elements in Lexicographical Order (Dictionary Order)

Potti Chandra Sekhar sai
Potti Chandra Sekhar sai
Updated on 24-Nov-2022 759 Views

In this tutorial, we discuss writing a program to sort elements in lexicographical order in the Haskell programming language. Haskell is a Declarative, Strongly Typed, and Functional programming language. The computations in Haskell are mathematical functions. The lexicographical order is a dictionary order or in the order of the ASCII values of a character. In this tutorial, we see two different ways to implement a program to sort elements in lexicographical order in Haskell. Program to sort elements in lexicographical order using built-in function sort. Program to sort elements in lexicographical order using custom sorting functions. Algorithm steps ...

Read More

Haskell program to print ascii values

Potti Chandra Sekhar sai
Potti Chandra Sekhar sai
Updated on 24-Nov-2022 988 Views

In this tutorial, we discuss writing a program to print ASCII values in the Haskell programming language. Haskell is a Declarative, Strongly Typed, and Functional programming language. The computations in Haskell are mathematical functions. ASCII stands for American Standard Code for Information Interchange, used in electronic data transfer and communication. These ASCII values represent characters in electronic devices. These values are used to describe characters and data in digital devices. ASCII is a 7-bit number representing a character. Example: 7-bit binary “1100001” represents character ‘a’ whose ASCII value is 97. In this tutorial, we see two different ways to print ...

Read More

Haskell program to find the largest among three numbers

Potti Chandra Sekhar sai
Potti Chandra Sekhar sai
Updated on 24-Nov-2022 1K+ Views

In this tutorial, we discuss writing a program to find the largest among the three numbers Haskell programming language We are going to learn three different ways to implement programs to find the largest among three numbers in Haskell. Program to find the largest among three numbers using if-else. Program to find the largest among three numbers using function max. Program to find the largest among three numbers using function maximum. Syntax variables in functions returning IO actions can be declared and initialized instantaneously using the “let” keyword. let num=100 The above line loads an Integer value ...

Read More

Haskell program to find all roots of a quadratic equation

Potti Chandra Sekhar sai
Potti Chandra Sekhar sai
Updated on 24-Nov-2022 1K+ Views

In this tutorial, we discuss writing a program to find the largest among the three numbers Haskell programming language. A quadratic equation is a second-degree algebraic equation. Example − a quadratic equation is of the form ax^2 + bx + c, where a, b, and c are constants and x is variable. A quadratic equation has two roots. Algorithm steps Take a quadratic equation as input. Implement the programming logic to compute the roots. Display the roots. Algorithm Logic Take input or initialize values for a, b, and c. As the quadratic expression can be constructed with ...

Read More
Showing 11–20 of 33 articles
Advertisements