Found 33676 Articles for Programming

Haskell Program to Count the Number of Vowels and Consonants in a Sentence

Potti Chandra Sekhar sai
Updated on 24-Nov-2022 06:27:42

732 Views

In this tutorial, we discuss writing a program to count the number of vowels and consonants in a Sentence in the Haskell programming language. Haskell is a Declarative, Strongly Typed, and Functional programming language. The computations in Haskell are mathematical functions. Vowels are the open sound-producing letters in English literature. The list of vowels in the English alphabet is ‘a’, ’e’, ’i’, ’o’, and ’u’. The other letters are consonants. In this tutorial, we see two different ways to implement the program to count the number of vowels and consonants in Haskell. Implementing the program to count the number ... Read More

Haskell program to compute quotient and remainder

Potti Chandra Sekhar sai
Updated on 24-Nov-2022 06:26:36

751 Views

In this tutorial, we discuss writing a program to compute the quotient and remainder in Haskell programming language. Quotient and remainder are the quantities obtained as a result of dividing two quantities. Example − quotient and remainder for the division of 31/5 are 6, 1 respectively. The number can be represented as 31 (dividend) = 5(divisor) * 6(quotient) + 1(remainder). In this tutorial, we see four different ways to write a program to compute quotient and remainder. Haskell program to compute the quotient and the remainder using built-in functions div and mod Haskell program to compute the quotient and ... Read More

Haskell Program to Check if two of the three Boolean variables are true

Potti Chandra Sekhar sai
Updated on 24-Nov-2022 06:24:13

322 Views

In this tutorial, we discuss writing a program to check if two of three Boolean variables are true in the Haskell programming language Boolean variables are the type of variable which hold the boolean value true and false. In this tutorial, we see two different ways to implement a program to check if two of the three boolean values are true Program to check if two of the three boolean values are true in an iterative method. Program to check if two of the three boolean values are true in a recursive method. Algorithm steps Declare or ... Read More

Haskell program to calculate the sum of natural numbers

Potti Chandra Sekhar sai
Updated on 24-Nov-2022 06:22:43

1K+ Views

In this tutorial, we discuss writing a program to calculate the sum of the natural numbers in the Haskell programming language. Natural numbers are positive integers starting from 1, 2, 3...N In this tutorial, we see different ways to implement a program to compute the sum of natural numbers. Program to compute the sum of the natural numbers using a mathematical formula. Program to compute the sum of the natural numbers using a recursive function. Program to compute the sum of the natural numbers using the list method/function sum. Algorithm steps Declare or take input the range ... Read More

Haskell Program to Calculate simple interest and compound interest

Potti Chandra Sekhar sai
Updated on 24-Nov-2022 06:21:17

494 Views

In this tutorial, we discuss writing a program to calculate simple and compound interest in the Haskell programming language In this tutorial, we see Program to compute Simple interest. Program to compute Compound interest. Simple interest is an Interest method for an investment, where interest is defined as I = p*t*r/100, where p is the invested amount, t is the quantity of time in years, and r is the interest rate. (per 100). Example − For an invested amount of 1000(p), t= 2 and r =3 the interest is 60. Compound interest is an Interest method for an ... Read More

Golang Program to Print Spiral Pattern of Numbers

Akhil Sharma
Updated on 22-Nov-2022 13:06:30

393 Views

In this tutorial, we will learn how to print spiral pattern of Numbers using Go programming language. A Spiral pattern of numbers is used to print numbers in spiral pattern on the screen. In this program we will create an array of size n, store numbers in it and use the array to create a matrix in a spiral format. Syntax for initialization; condition; update { statement(s) } func make([]T, len, cap) []T make() function is used to allocate memory of heap for some variables. For eg we can use make() function to allocate memory for ... Read More

Golang Program to Print Reverse Pyramid Star Pattern

Akhil Sharma
Updated on 22-Nov-2022 13:02:15

656 Views

In this tutorial we will write a Go-lang code to print Reverse pyramid star pattern. We will depict how you can print the reverse pyramid star pattern. ********* ******* ***** *** * How to print a Reverse Pyramid star pattern? A pattern is shown above, and in the pattern, you can clearly see that 2 stars is decreasing with increase in each row. If the total rows are 5, the pattern goes like ... Read More

Golang Program to Print Pyramid Star Pattern

Akhil Sharma
Updated on 22-Nov-2022 12:58:40

883 Views

In this tutorial we will write a Go language code to print pyramid star pattern. We will depict how you can print the pyramid star pattern. * * * * * * * * * * * * * * * * * * * * * * * * * How to print a Pyramid star pattern? A pattern is shown above, and in the pattern, you can clearly see that 2 stars is increasing with increase in ... Read More

Golang Program to convert int type variables to String

Akhil Sharma
Updated on 22-Nov-2022 12:49:27

17K+ Views

In this tutorial we will learn how to convert int type variables to string variables using Golang programming language. A string is defined as the sequence of one or more characters (letters, numbers, or symbols). Computer applications frequently use strings as a data type thus, there is a need to convert strings to numbers or numbers to strings at manny places specially when we are using data entered by the user. Syntax func Itoa(x int) string Itoa() function in go programming language is used to get the string representation of any integer value here it is depicted by ... Read More

Golang Program to convert double type variables to string

Akhil Sharma
Updated on 22-Nov-2022 12:21:36

873 Views

In this tutorial we will learn how to convert double(float64) type variables to string variables using Golang programming language. Double stands for double precision. In programming languages, a double data-type is used to handle decimal numbers more precisely i.e. using double data type we can store more number of digits after a decimal point with accuracy. String data type is used to store a sequence of characters. It can be in the form of literals or alphabets. The size of string variable is 1 byte or 8 bits. EXAMPLE 1: GO LANGUAGE CODE TO CONVERT DOUBLE TYPE ... Read More

Advertisements