
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

239 Views
In this article, we will learn how to write a swift program to display lower triangular matrix. Lower triangular matrix is a matrix in which all the elements above primary diagonal are zero. As shown in the below image: $$\mathrm{\begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0ewline 3 & 5 & 0 & 0 & 0 & 0ewline 1 & 4 & 6 & 0 & 0 & 0ewline 1 & 2 & 2 & 2 & 0 & 0ewline 4 & 5 & 6 & 1 & 2 & 0ewline 1 & 1 & 1 ... Read More

788 Views
In this article, we will learn how to write a swift program to compute the sum of diagonals of a matrix. Every matrix has two diagonals which are known as primary and secondary diagonals. For example, we have the following 5x5 square matrix − 2 3 4 5 6 4 6 7 8 9 1 1 1 3 4 4 0 4 0 4 0 0 1 1 1 So the primary diagonal is formed by using elements 2, 6, 1, 0, 1 and the secondary diagonal is formed by using elements 6, 8, 1, 0, 0. Hence the ... Read More

178 Views
In this article, we will learn how to write a swift program to check whether two matrices are equal or not. Here, we create two matrices, and using the not equal to the operator (!=), we check whether all the elements of both matrices are equal or not. Algorithm Step 1 − Create a function. Step 2 − Use nested for loop to iterate through each row and column. Step 3 − Check if the element of matrix1 is not equal to matrix2. If the condition is true, then return 0, otherwise, return 1. Step 4 − Create two ... Read More

720 Views
In this article, we will learn how to write a swift program to calculate standard deviation. Standard deviation is a measure, which will represent how much variation from the mean exists, or we can say that it is used to calculate the extent to which the values are differ from the average. $$\mathrm{\sigma\:=\:\sqrt{{\frac{1}{N}}\sum_{i=1}^N\:(X_i-\mu)^2}}$$ The mathematical formula of standard deviation is- σ = standard deviation N = total number of elements Xi = ith element \mu = Mean of the given elements Therefore, in this article, we calculate the standard deviation of the given array by using the ... Read More

3K+ Views
In this article, we will learn how to write a swift program to calculate averages using an array. Average is defined as the ratio of the sum of the elements present in the given sequence to the total number of elements available in the given sequence. The general formula of average is − Average = (p1+p2+p3+..+pn)/n Here we use the following methods to calculate the average using array − Using pre−define functions Without using predefine functions Method 1: Using Pre-Define Functions To find the average of the given array, we use reduce() method to find the sum ... Read More

394 Views
The product of two numbers is the result you get when you multiply them together. So 15 is the product of 3 and 5 and 22 is the product of 2 and 11 and so on. A Recursion is where a function calls itself by direct or indirect means. Every recursive function has a base case or base condition which is the final executable statement in recursion and halts further calls. Example-1: Golang Program Code to Find The Product of Two Numbers Using Recursion by Using The Direct Recursion Method Syntax Syntax for direct recursion func recursion() { ... Read More

923 Views
In this tutorial program, we will learn how to display the factors of a given number in the Go programming language. A factor of a number is defined as the algebraic expression that divides any given number evenly, with its remainder being zero. All composite numbers will have more than two factors, that include 1 and the number itself also. For example: by multiplying 3 and 7, we get 21. We say 3 and 7 are factors of 21. Below is a demonstration of the same − Input Suppose our input is = 15 Output The factors of 15 ... Read More

33K+ Views
In this tutorial, we will learn how to convert string values to byte values using golang programming language. String Value − A string value is just a sequence of characters, like "abc". A string value is always enclosed in quotes. All types of characters are allowed (even digits, as in "abc123"). Strings can contain any number of characters. Byte value − The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, where ... Read More

5K+ Views
In this tutorial, we will learn how to convert character type to integer type variable using Golang programming language. In the Go programming language, there is no char data type. It uses bytes and rune and strings to represent character values. Example-1: Golang Program Code to Convert Char to Int Using Atoi() Function Syntax func Atoi(str string) (int, error) Here, str is the string. Atoi() function is equivalent to ParseInt(str string, base int, bitSize int) is used to convert string type into int type and to access Atoi() function you need to import strconv Package in your program. Algorithm ... Read More

4K+ Views
In this tutorial, we will learn how to convert an array to a set using the Golang programming language. A Set is a collection of items. You can iterate on these items / add new / remove items and clear the set and get the size and check if the set contains any value. An object in the set might only be stored once and cannot duplicate. Syntax var myset map[type]struct{} Key is a type of data you want to create. Struct{} is an empty struct that takes 0 bytes in size. Example 1: Go Code to Convert an ... Read More