Csharp Articles

Page 84 of 196

C# Program to Convert Character case

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 634 Views

Converting character case in C# is a common string manipulation task. The string class provides built-in methods ToLower() and ToUpper() to convert strings to lowercase and uppercase respectively. Syntax Following is the syntax for converting string case − string.ToLower() // Converts to lowercase string.ToUpper() // Converts to uppercase Both methods return a new string with the case converted and do not modify the original string. Using ToLower() Method The ToLower() method converts all uppercase characters in a string to lowercase − using System; ...

Read More

What is the operator that concatenates two or more string objects in C#?

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 688 Views

The + operator is used to concatenate two or more string objects in C#. This operator provides a simple and intuitive way to combine strings, making it one of the most commonly used string operations in C# programming. Syntax Following is the basic syntax for string concatenation using the + operator − string result = string1 + string2; string result = string1 + string2 + string3; Using + Operator for String Concatenation Example 1: Basic String Concatenation using System; class Program { static void Main() { ...

Read More

C# Program to convert Digits to Words

Samual Sam
Samual Sam
Updated on 17-Mar-2026 4K+ Views

Converting digits to words in C# involves breaking down a number into its individual digits and mapping each digit to its corresponding word representation. This technique is commonly used in financial applications, report generation, and number-to-text conversion systems. Algorithm Overview The conversion process follows these steps − Create an array of word strings for digits 0-9 Extract each digit from the number using modulo operation Store digits in reverse order (rightmost digit first) Map each digit to its corresponding word and display in correct order Digit-to-Word Conversion Process ...

Read More

C# Program to Convert Decimal to Binary

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 1K+ Views

Converting a decimal number to binary involves repeatedly dividing the decimal number by 2 and collecting the remainders. In C#, this can be accomplished using manual division or built-in methods like Convert.ToString(). The manual approach uses the division by 2 method where we divide the decimal number by 2, store the remainder, and continue until the quotient becomes 0. The binary representation is formed by reading the remainders in reverse order. Using Manual Division Method This method involves dividing the decimal number by 2 repeatedly and collecting remainders − Decimal to Binary ...

Read More

C# Program to Convert Fahrenheit to Celsius

Samual Sam
Samual Sam
Updated on 17-Mar-2026 3K+ Views

Temperature conversion between Fahrenheit and Celsius is a common programming task. In C#, you can easily convert Fahrenheit to Celsius using a simple mathematical formula and display the results with proper formatting. The conversion formula subtracts 32 from the Fahrenheit temperature, then multiplies by 5/9 to get the equivalent Celsius temperature. Formula The mathematical formula for converting Fahrenheit to Celsius is − celsius = (fahrenheit - 32) * 5 / 9 Fahrenheit to Celsius Conversion 97°F - 32 × 5/9 ...

Read More

C# Program to convert first character uppercase in a sentence

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 561 Views

Converting the first character of each word to uppercase in a sentence is a common text formatting task in C#. This process involves identifying word boundaries and converting the first lowercase letter of each word to its uppercase equivalent. Syntax Following is the basic approach to convert characters from lowercase to uppercase − char uppercaseChar = (char)(lowercaseChar - 'a' + 'A'); To check if a character is a lowercase letter − if (ch >= 'a' && ch = 'a' && val[i] = 'A' && val[i] word.Length > 0 ? ...

Read More

Char.IsUpper() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 2K+ Views

The Char.IsUpper() method in C# determines whether a specified Unicode character is categorized as an uppercase letter. It returns true if the character is an uppercase letter, otherwise false. Syntax Following is the syntax of the Char.IsUpper() method − public static bool IsUpper(char ch); Parameters ch − The Unicode character to evaluate. Return Value This method returns a bool value − true if the character is an uppercase letter false if the character is not an uppercase letter Using ...

Read More

C# program to convert decimal to Octal number

Samual Sam
Samual Sam
Updated on 17-Mar-2026 835 Views

A decimal number can be converted to an octal number using the division method. Octal is a base-8 number system that uses digits 0-7. To convert from decimal to octal, we repeatedly divide the decimal number by 8 and collect the remainders. How It Works The conversion process involves dividing the decimal number by 8 repeatedly and storing the remainders. The octal equivalent is formed by reading the remainders in reverse order − Decimal 40 to Octal Conversion 40 ÷ 8 = 5 ...

Read More

C# Program to Count the Number of 1's in the Entered Numbers

Samual Sam
Samual Sam
Updated on 17-Mar-2026 683 Views

This C# program demonstrates how to count the occurrences of a specific number (1) in an array of integers. We'll use an array to store the numbers and iterate through it to count how many times the value 1 appears. Syntax Following is the syntax for declaring an array and using a foreach loop to iterate through it − int[] arrayName = new int[] {value1, value2, value3}; foreach(int variable in arrayName) { // process each element } Using Array and foreach Loop The most straightforward approach is to use ...

Read More

Byte.Equals(Byte) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 368 Views

The Byte.Equals(Byte) method in C# returns a value indicating whether this instance and a specified Byte object represent the same value. This method provides a reliable way to compare two byte values for equality. Syntax Following is the syntax − public bool Equals(byte obj); Parameters obj − A byte object to compare to this instance. Return Value Returns true if obj has the same value as this instance; otherwise, false. Using Byte.Equals() for Value Comparison Example using System; public class Demo { public static ...

Read More
Showing 831–840 of 1,951 articles
« Prev 1 82 83 84 85 86 196 Next »
Advertisements