Server Side Programming Articles

Page 1699 of 2109

C++ Program to Iterate Over an Array

Arnab Chakraborty
Arnab Chakraborty
Updated on 14-Dec-2022 4K+ Views

Arrays are data of the same type stored in contiguous locations in memory. To access or address an array, we use the starting address of the array. Arrays have indexing, using which we can access the elements of the array. In this article, we take a look at methods to iterate over an array. This means accessing the elements that are present in an array. Using for loop The most common method of iterating over an array is using for loops. We use a for loop to iterate through an array in the next example. One thing is to be ...

Read More

Haskell Program to Display Fibonacci Series

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

This tutorial discusses writing a program to display Fibonacci Series in the Haskell programming language. The Fibonacci series is a sequence in which each number is the sum of the preceding two terms. The Fibonacci series up to five terms is 0 1 1 2 3. In this tutorial we see, Program to print nth fibonacci number. Program to print the first ‘n’ terms in the Fibonacci series. Program to print the first ‘n’ terms in the Fibonacci series using the list comprehension. Program to print the first ‘n’ terms in the Fibonacci series using the map function. ...

Read More

Haskell Program to Print the Multiplication Table in Triangular Form

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

This tutorial discusses writing a program to print the multiplication table in the triangular form in the Haskell programming language. For example, the multiplication table for the number 10 in the triangular format is 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 6 12 18 24 30 36 7 14 21 28 35 42 49 8 16 24 32 40 48 56 64 9 18 27 36 45 54 63 72 81 10 20 30 40 50 60 70 80 90 100 Algorithm Steps Take input or initialize an integer variable ...

Read More

C++ Program to Sort the Elements of an Array in Descending Order

Arnab Chakraborty
Arnab Chakraborty
Updated on 14-Dec-2022 3K+ Views

Arranging data items in a proper form is an essential task while solving some problems in an efficient way. The element sorting problem is one of the most commonly discussed arranging problem. In this article we will see how to arrange the array elements in descending order (decreasing order of their values) in C++. There are many different sorting algorithms present in this domain to sort numeric or nonnumeric elements in a given order. In this article we will see only two simple methods of sorting. The bubble sort and the selection sort. Let us see them one by one ...

Read More

C++ Program to Convert Set of String to Array of String

Arnab Chakraborty
Arnab Chakraborty
Updated on 14-Dec-2022 2K+ Views

Sets in C++ re containers that contain unique values of a specific type. Arrays or the array container in std C++ is a fixed-size container that contains elements of a specific size. Arrays are like vectors, but the main difference is that arrays are of a fixed size whereas vectors can be dynamic. The array container in C++ is a wrapper for the standard arrays that are available in both C and C++. There is a problem in this conversion though, std arrays do not have support for the common insertion methods that are available with the other containers. So, ...

Read More

Haskell Program to Swap Two Numbers

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

This tutorial discusses writing a program to swap two numbers in the Haskell programming language. Variables are immutable in Haskell i.e once declared their values cannot be changed. So we cannot swap the values of two variables, but we can mimic this by swapping values in a list and tuple. In this tutorial we see, Program to swap two numbers in a binary tuple. Program to swap two numbers in a list. In Haskell, tuples are used to store elements of different data types as a collection. Tuples are identified by parenthesis at the ends. Tuples support only ...

Read More

C++ Program to Convert List to Set

Arnab Chakraborty
Arnab Chakraborty
Updated on 14-Dec-2022 3K+ Views

Lists in C++ are containers the same as vectors, but list implementation is based on doubly linked lists compared to the array implementation of vectors. Lists generally do not contain elements in contiguous locations, the elements of a list are distributed throughout the memory. Lists offer the same constant time operations anywhere in it, that is the main feature of using lists. Sets on the other hand are containers that contain unique values of a certain type and all the elements are sorted in ascending order. The two containers are different, but there are various ways to convert a list ...

Read More

Haskell Program to determine the name and version of the operating system

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

This tutorial discusses writing a program to find the operating system info in the Haskell programming language. Haskell provides functions to find the system info. These functions can be accessed by importing the Info module from the System package in Haskell. In this tutorial, we see Program to display the name of the Operating System. Program to display the architecture of the processor. Program to display the compiler name. Program to display the compiler version. Syntax To import a module in Haskell the syntax is to follow. import packageName.moduleName To import the Info module from the system ...

Read More

C++ Program to Print X Star Pattern

Arnab Chakraborty
Arnab Chakraborty
Updated on 14-Dec-2022 4K+ Views

Displaying star patterns in different shapes, like pyramids, squares, and diamonds, is a common part of basic programming and logic development. We faced various problems involving stars and numerical patterns as we studied looping statements in programming. This article will demonstrate how to print an X or a cross using stars. We will see two methods for the same. First one is little bit complicated but the next method is much efficient. X Star Pattern (Using two sets of blank spaces) * * * * * ...

Read More

Haskell Program To Perform nCr (r-combinations)

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

This tutorial discusses writing a program to perform nCr combinations in the Haskell programming language. The nCr is used to find the number of ways r items can be selected from n items given that order doesn’t matter. The nCr is defined as n! / ( r! (n-r)! ). For example number of ways in which 3 items can be selected from 5 items is 5! / ( 3! (5-3)! ), i.e 10 ways. In this tutorial we see, Program to find the factorial of a number (helper function to find the nCr combinations). Program to find the ...

Read More
Showing 16981–16990 of 21,090 articles
Advertisements