Objective
Write a C# program to write the letters "B" to "N" (uppercase), using "for"
Write Your C# Exercise
C# Exercise Example
using System; // Import the System namespace to use basic classes like Console
class Program // Define the main class of the program
{
static void Main() // The entry point of the program
{
// Loop through the ASCII values of characters 'B' to 'N'
for (char letter = 'B'; letter <= 'N'; letter++) // Start at 'B' and loop until 'N'
{
Console.Write(letter); // Print the current letter
}
Console.WriteLine(); // Move to the next line after printing all letters
}
}
More C# Programming Exercises of Basic Data Types
Explore our set of C# programming exercises! Specifically designed for beginners, these exercises will help you develop a solid understanding of the basics of C#. From variables and data types to control structures and simple functions, each exercise is crafted to challenge you incrementally as you build confidence in coding in C#.
In this C# exercise, you are asked to write a program that calculates an approximation for PI using the alternating fraction series: pi/4 = 1/1 - 1/3 + 1/5 -...
In this C# exercise, you are asked to write a program that calculates the perimeter, area, and diagonal of a rectangle from its width and height....
In this C# exercise, you are asked to write a program that prompts the user for a number and displays it in both hexadecimal and binary. The program should continue r...
In this C# exercise, you are asked to write a program that prompts the user for a decimal number and displays its equivalent in binary. The program should continue re...
In this C# exercise, you are asked to write a program that uses the conditional operator (also known as the ternary operator) to assign a boolean variable named "bothEven...
In this C# exercise, you are asked to write a program that prompts the user for a real number and displays its square root. Additionally, the program must handle any ...