In this tutorial I will show simple nested for loop example in c sharp. When a loop performs within a loop is called nested loop. In this tutorial I have created two loops after creating first loop I have also created another...
Tag - C# For Loop Examples
Find the Largest Three Distinct Elements in an Array in C#
In this example, i’ll show you How to Find 3rd Maximum Number in an array in C#. C# Code: C# // C# code to find largest // three elements in an array using System; class PrintLargest { // Function to print three // largest...
Find 2nd Maximum Number in an array in C#
In this example, i’ll show you How to Find 2nd Maximum Number in an array in C#. C# Code: C# public static void Main() { int[] ar = { 31, -41, 26, 59, -53, 58, 97, -93, -23, 84 }; int max1 = 0, max2 = 0; for (int i = 0; i...
C# Loop Programs with Examples
In this tutorial, we will learn about the C# for loop and its working with the help of some examples. In computer programming, loops are used to repeat a block of code. For example, let’s say we want to show a message 100...
C# Program to find the second smallest element in an array
In this program, You will learn how to find the second smallest element in an array in C#. C# Code: How to find the second smallest element in an array in C#. C# using System; public class Program { public static void...
C# Program to Print all the Multiples of 13 which are Less than 100
C# Program to Print all the Multiples of 13 which are Less than 100. Here is source code of the C# Program to Print all the Multiples of 13 which are Less than 100. The C# program is successfully compiled and executed with...
Create Matrix(5 x 5) of Type Integer Holding Random Values in C#
In this example, i’ll show you How to create a matrix of random integers in C#. C# Code: C# static void Main(string[] args) { Random rnd = new Random(); const int MATRIX_ROWS = 5; const int MATRIX_COLUMNS = 5; double[,]...
Creating a 3×3 Matrix With User Input Numbers in C#
In this example, I will create a program that allows the user to enter numbers by creating a 3×3 matrix in the C # programming language. C# Code: C# static void Main(string[] args) { const int MATRIX_ROWS = 3; const int...
Input an integer (n) and computes the value of a+aa+aaa in C#
Write a program that computes the value of a+aa+aaa+aaaa with a given digit as the value of a in C#. Write a C# program that accepts an integer (n) and computes the value of n+nn+nnn. C# Code: C# class Program { static void...
Square pyramidal number (Sum of squares) of first n natural numbers in C#
In mathematics, a pyramid number, or square pyramidal number, is a figurate number that represents the number of stacked spheres in a pyramid with a square base. Square pyramidal numbers also solve the problem of counting the...