C# Console

C# Console Application Examples (50+ C# Examples)

C# is a simple, modern, general-purpose, object-oriented and high-level programming language originally developed by Microsoft and released in 2002. This tutorial gives a complete understanding of C#. This reference will take you through simple and practical approaches while learning C# Programming language.

There are more over 40 examples in this C# examples list. And C# Examples are listing from basic to complex

Basic C# Examples

Example 1: C# Program to Print Hello World

Example 2: C# Program to Print an Integer Entered by User

 

Example 3: C# Program to Add Two Integers

 

Example 4: C# Program to Multiply two Floating Point Numbers Entered by User

 

Example 5: Multiply Two Floating Point Numbers in C# Console

 

Example 6:  C# Program to Compute Quotient and Remainder

 

Example 7: Program To Calculate the Simple Interest in C#

Code:

Output:

Example 8: C# Calculate Rectangle Area

Code:

Output:

area-of-rectangle

 

Example 9: C# Square Area and Perimeter Calculator

Code:

Output:

square-area-perimeter

Example 10: Area and Perimeter of Circle in C# Console Application

Code:

circle-area-perimeter

 

Example 11: Program to finds the average of 3 numbers in C#

Code:

Output:

 

Example 12: C# Math.Pow Example

Code:

Output:

 

Example 13: C# Math.Pow Negative Exponent Example

Code:

Output:

Example 14: C# Program to Count Number of Words in a String

Code:

Output:

 

Example 15: Convert Dollars to Cents in C#

Solution 1: Calculate in Main Method

 

Solution 2: Calculate with Custom Method

Output:

 

For More Simple Examples

 


C# Conditional Examples

 

Example 16: Fibonacci Series in C# with Method

C# Code:

Output:

 

Example 17: Find Number is Even or Odd using if else Statement in C#

Code 1:

Code 2 (with static method):

Output:

Example 18: Find Numbers Above and Below the Average in C#

C# Code:

Output:

Example 19: C# Program to Print all Prime Numbers in an Interval

Source Code:

Output:

 

Example 20: Finding the biggest of three numbers in C#

C# Code:

Output:

Example 21: Generates the Sum of N Numbers in C#

Code:

Output:

 

Example 22: Counting program the total letter in text in C# Console

Code:

Alternavite code (foreach loop):

Output:

 

Example 23: Get Month Name From Month Number – C#(Switch Case)

C# Code:

 

Output:

 

Example 24: Program Library Fine Calculation in C#

The fee structure is as follows:

  1. If the book is returned on  before  5 days, no fine will be charged.
  2. If the book is returned after the expected return day (between 5 and 10 days) – fine: 0.5$ per day
  3. If the book is returned after the expected return day (between 10 and 30 days) fine: 1$ per day
  4. If the book is not returned after 30 days, cancel membership. fine: 1.5$ per day

Code:

Output

 

Example 25: Program to Find Leap Year in C#

Code:

Output:

 

For Mode If Else Examples

C# Loop Examples

Example 26: C# program to find min and max in an array

Code:

 

Output:

C# program using for loop to find maximum value from an array

 

Example 27: C# Program to Calculate the Power of a Number Without Using Math.Pow

Code:(With for loop)

 

Code: (With While Loop)

Output:

 

Example 28: C# Program to Find the Factorial of a Number

Source Code:

Output:

 

Example 29: Display Numbers Between 1 to N Using For Loop

Code:

Output:

For Loop

 

Example 30: Generates the Sum of N Numbers in C#

Code:

Output:

 

Example 31: C# Program to Print all Prime Numbers in an Interval

Source Code:

Output:

 

Example 32: Nested For Loop in C# (Multiplication Table)

Code 1:

Output:

 

Code 2:

Output:

Example 33: Display Armstrong Number Between Two Intervals in C#

Code:

Example 34: Checking for Palindrome Strings or Numbers in C#

Code:

 

Example 35: Converting Algorithm of Decimal to Binary in C#

Other way:  You can convert decimal to number, If you want to without think any algorithm

Output:

Example 36: Find The Second Largest Number in Array Using C#

Example 36: Enter Only Numbers in C# Console Application using do-while loop

 

Example 37: C# Program to Calculate the Power of a Number Without Using Math.Pow using while loop

Example 38: Fibonacci Series in C# with Method

 

Example 39: Calculate Sum and Average of an Array in C#

 

Example 40: Find Numbers Above and Below the Average in C#

 

 

C# For Loop Examples

 

C# While Loop Examples

 

C# Foreach Examples

 

C# Array Examples

 

2 Comments

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.