Csharp Articles

Page 75 of 196

C# Program to Check if an Array is Sorted

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 5K+ Views

We are given an array, and we need to check whether the array is sorted or not. The array can be sorted in either ascending or descending order. In this article, we will discuss different approaches to check if an array is sorted using C#. Problem Examples Input: array = {1, 2, 3, 4, 5} Output: True Explanation: The array is sorted in ascending order. Input: array = {29, 28, 27, 26, 25, 24} Output: True Explanation: The array is sorted in descending order. Input: array = {12, 10, 19, 11, 9} Output: False Explanation: The ...

Read More

C# Program to Calculate the Area of a Circle

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 5K+ Views

A circle is a round two-dimensional shape where all points on the boundary are equidistant from the center. The distance from the center to any point on the circle's edge is called the radius. Calculating the area of a circle is a fundamental geometric operation commonly used in programming. Formula for Circle Area The area of a circle is calculated using the formula − Area = π × r² Where: π (pi) ≈ 3.14159 or Math.PI in C# r is the radius of the circle Circle ...

Read More

C# program to check if a matrix is symmetric

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 6K+ Views

In this article, we are going to discuss how we can check if a matrix is symmetric or not using C#. What is a Symmetric Matrix? A symmetric matrix is a square matrix (matrix which has the same number of rows and columns) in which the element at position A[i][j] is equal to the element at A[j][i] for all i and j. In simple words, a matrix is called symmetric if it is equal to its transpose. Symmetric Matrix Property Original Matrix 1 2 3 ...

Read More

C# Program to Check If a Number is a Happy Number

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 8K+ Views

We are given a number as input, and we need to check whether it is a happy number or not. In this article, we will learn how to check if a number is a happy number using C#. What is a Happy Number? A happy number is a number that eventually becomes equal to 1 when we repeatedly replace it with the sum of the squares of its digits. If the number gets stuck in a cycle and never reaches 1, then it is not a happy number. Happy Number Process ...

Read More

C# Program to Check if a Number is Perfect

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 12K+ Views

A perfect number is a positive integer that equals the sum of its proper divisors (all divisors excluding the number itself). For example, 6 is perfect because its proper divisors (1, 2, and 3) sum to 6. Proper divisors are numbers that divide evenly into the given number without leaving a remainder. Perfect Number: 6 1 2 3 = 6 6 ÷ 1 = 6 6 ÷ 2 = ...

Read More

C# Program to Return Quadrant in which the Coordinate Lie

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 4K+ Views

The Cartesian coordinate system is divided into four quadrants based on the signs of x and y coordinates. In this article, we will learn how to determine which quadrant a given point lies in using C#. Understanding Quadrants The coordinate plane is divided into four regions called quadrants − Quadrant I: x > 0 and y > 0 (both positive) Quadrant II: x < 0 and y > 0 (x negative, y positive) Quadrant III: x < 0 and y < 0 (both negative) Quadrant IV: x > 0 and y < 0 (x positive, y ...

Read More

C# Program to Subtract Two Numbers

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 6K+ Views

In this article, we will learn how to subtract two numbers in C# using different programming approaches. Subtraction is one of the fundamental arithmetic operations where we find the difference between two values. Problem Description Given two numbers, we need to find the result of subtracting one number from another. We'll explore multiple methods to perform this operation in C#. Example 1 Input:number1 = 8number2 = 12 Output: 4 Explanation The subtraction of number2 - number1, i.e., 12 - 8, will result in 4. Example 2 Input:number1 = 10number2 ...

Read More

Remove all even numbers from an array in C#

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 19K+ Views

Removing all even numbers from an array is a common programming task that involves filtering out numbers divisible by 2. In C#, we can accomplish this using various approaches such as iterative methods, LINQ, or recursion to create a new array containing only odd numbers. Problem Description We are given an array and need to remove all the even numbers from it. The resulting array should only contain odd numbers. An even number is any integer that is divisible by 2 (i.e., number % 2 == 0), while an odd number leaves a remainder of 1 when divided ...

Read More

Calculate the sum of squares of the first N natural numbers in C#

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 4K+ Views

In this problem, we are given a number N, and we need to calculate the sum of the squares of the first N natural numbers. The first N natural numbers are 1, 2, 3, ..., N, and we need to find 1² + 2² + 3² + ... + N². Problem Description Given a positive integer N, calculate the sum of squares of the first N natural numbers using different approaches in C#. Example 1 Input: N = 4 Output: 30 Explanation: The squares of the first 4 natural numbers are: 1², ...

Read More

C# Program to Find Volume, Perimeter and Surface Area of Cuboid

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 7K+ Views

A cuboid is a three-dimensional geometric shape with six rectangular faces, where opposite faces are equal in dimensions. It has three dimensions: length, breadth (width), and height. We can calculate the volume, perimeter, and surface area of a cuboid using specific mathematical formulas. Cuboid Structure Length Breadth Height Formulas The following formulas are ...

Read More
Showing 741–750 of 1,951 articles
« Prev 1 73 74 75 76 77 196 Next »
Advertisements