C++ Program to Print X Star Pattern

Arnab Chakraborty
Updated on 14-Dec-2022 12:09:10

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
Updated on 14-Dec-2022 12:06:48

469 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

Print Hollow Right Triangle Star Pattern in C++

Arnab Chakraborty
Updated on 14-Dec-2022 12:06:16

1K+ Views

Displaying star patterns in different formats like pyramids, squares, and diamonds is very common in fundamental programming and logic building. We have seen several stars and number pattern problems while learning looping statements in programming. In this article, we will see how to print a hollow right triangle star pattern in C++. In this program, we take the line number n this will create a star pattern for n number of lines. Let us see the example for the same. Hollow Right Star Pattern * ... Read More

Get Keys from a Hashtable in C#

Shilpa Nadkarni
Updated on 14-Dec-2022 12:04:46

433 Views

The HashTable is a non−generic collection in C#. It stores key−value pairs and is similar to a generic “Dictionary” collection. HashTable is defined in System.Collections.namespace. HashTable consists of key/value pairs in which each key is computed as a hash code and stored in a different bucket internally. Whenever the HashTable is accessed, this hash code is matched to the hash code of the specified key and thus the corresponding values are accessed. This mechanism optimizes the lookup in the HashTable. Let’s now discuss how to get keys from a HashTable in C#. How to Get Keys from a HashTable? ... Read More

Find the Perimeter of a Circle in Haskell

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 12:00:56

378 Views

This tutorial discusses writing a program to find the perimeter of a circle in the Haskell programming language. The perimeter of the circle is the length of the boundary of the circle. The perimeter of a circle is also called the circumference. The perimeter of a circle is defined as 2*pi*r where r is the radius of the circle. For example area of the circle with a radius of 4 units is 25.13274 (2*pi*4). In this tutorial, we see two ways to implement a program to find the perimeter of a circle. Program to find the perimeter of ... Read More

Haskell Program to Find the Area of a Trapezium

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 11:55:05

177 Views

This tutorial discusses writing a program to print the area of a trapezium in the Haskell programming language. A trapezium is a quadrilateral with one opposite side parallel. The above figure is a trapezium. The length of one of the parallel sides is denoted by a and the other side is denoted by b. The height of the trapezium is denoted by h. The area of a trapezium is defined as (a+b)/(2*h), where a and b are the lengths of the parallel sides and h is the height or distance between the parallel sides. In this tutorial, we see ... Read More

Find the Area of a Square in Haskell

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 11:53:01

526 Views

This tutorial discusses writing a program to print the area of a square in the Haskell programming language. The square is a quadrilateral with all sides of the same length. The area of a square is equal to the square of the size of the side. If the side of the square has a size of 5 units, then the area of that is 25 units(5*5). In this tutorial, We see four ways to implement. Program to compute the area of a square using the infix operator “*”. Program to compute the area of a square using the ... Read More

Create Hashtable Collection in C#

Shilpa Nadkarni
Updated on 14-Dec-2022 11:49:16

247 Views

The HashTable is a non−generic collection in C#. It stores key-value pairs and is similar to a generic “Dictionary” collection. HashTable is defined in System. Collections. namespace. HashTable computes the hash code of each key and stores it in a different bucket internally. The hash code is then matched to the hash code of the specified key when the values are accessed. Thus the lookups are optimized by HashTable. In this tutorial, we will see how we can create a HashTable collection in C#. Hashtable Features Before we jump to creating a HashTable, let us see some of ... Read More

Check If Key Exists in Hashtable in C#

Shilpa Nadkarni
Updated on 14-Dec-2022 11:47:21

2K+ Views

The Hashtable class in C# represents a collection of key-value pairs. These key-value pairs are organized based on the hash code of the key that is calculated using the hash code function. The key in the hashtable accesses the items. So given a key, we can access the corresponding value for that key in the hashtable. The keys in the hashtable are unique and non-null. The values however can be null or duplicated. We have been discussing hashtable topics in our earlier tutorials. We continue the trend in this article as well. In this article, we will discuss how to ... Read More

Calculate the Power of a Number in Haskell

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 11:41:06

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

Advertisements