Tech Study

C# Programming Examples and Solutions

C# which is comonly known as CSharp is a General Purpose, modern programming language which is object oriented. CSharp was depeloped my a team lead by Anders Hejlsberg at Microsoft. C# was developed within the .Net framework. It was approved by the European Computer Manufacturers Association (ECMA) and International Standards Organization (ISO). Syntax of CSharp is somewhat similar with Java and it is for those developers who already have good command over C and C++ Programming languages.

About .Net Framework

.Net framework is a multi programming langguage application. You can can use C++, C#, Visual Basic, COBOL etc. It is designed in a way that other programming languages can opt it and use it.

To know more about .Net Framework Please read our article about .Net
.Net Programs

Why Should You Learn C# Programming Language?

There are a lot of reasons for C# Being popular and in demand.

  • If you already know C, C++ or Java it will be really easy to learn and start coding in C#
  • C# is the most popular language which is used for developing web applications and desktop applications.
  • CSharp has a large community of developers using it. So there are a lot of tools and softwares to make things easy.
  • C# is the dominating tchnology or programming language in Game Development.

C# was developed by Microsoft in 2002. C# development team was lead by Danish software engineer Anders Hejlsberg. This programming Language was designed for Common Language Infrastructure (CLI)

New to coding world or want to learn more about coding , Here are some of the book we highly recommend you should read once in your lifetime
6 Best Coding Books for Beginners You Must Read in 2023

 

The best way to learn C# programming language is by practicing C# Programming examples. All the following C# Language programs on this webpage are tested and should work on all C# Programming Compiler.

List of C# Programming Examples

C# Language Basic programs with examples

  1. C# Program to Print “Hello, World!”
  2. C# Program to Add Two Integers.
  3. C# Program to Swap Values of Two Variables.
  4. C# Program to Multiply two Floating Point Numbers
  5. C# Program to perform all arithmetic operations
  6. C# Program to convert feet to meter
  7. C# Program to convert celcius to farenheit
  8. C# Program to convert farenheit to celcius
  9. C# Program to find the Size of data types
  10. C# Program to Print ASCII Value
  11. C# Program to Calculate Area of Circle
  12. C# Program to Calculate Area of Square
  13. C# Program to Calculate Area of Rectangle
  14. C# Program to convert days to years, weeks and days

List of all conditional programs in c# language

  1. C# Program to check whether an integer entered by the user is odd or even
  2. C# Program to find the largest number among three number.
  3. C# Program to Find the Largest Number using Conditional Operator.
  4. C# Program to find the Largest among Three Variables using Nested if.
  5. C# program to check leap year using conditional Operator.
  6. C# Program to Check whether an alphabet is a vowel or not.
  7. C# program to check number is positive, negative or zero.
  8. C# program to check uppercase or lowercase alphabets.
  9. C# program to check entered character vowel or consonant.
  10. C# program to check whether a character is alphabet, digit or special character.
  11. C# program to print day name of week.
  12. C# program to accept two integers and check whether they are equal or not.
  13. C# program to detrermine a candidate’s age is eligible for casting the vote or not.
  14. C# program to find the eligibility of admission for an engineering course based on the criteria.
  15. C# program to calculate the total marks, percentage and division of student.
  16. C# program to enter month number and print number of days in month.
  17. C# program to count total number of notes in entered amount.
  18. C# program to check whether a triangle can be formed by the given value for the angles.

List of C# Language Loop Programs with Examples

  1. Write C# program to print alphabets from a to z
  2. Write C# program to print ASCII values of all characters
  3. Write C# program to print multiplication table of a given number
  4. Write C# program to print all natural numbers in reverse order
  5. Write C# program to print sum of digits enter by user
  6. Write C# program to find sum of even numbers between 1 to n
  7. Write C# program to find sum of odd numbers between 1 to n
  8. Write C# program to swap first and last digit of a number
  9. Write C# program to find the sum of first and last digit of any number
  10. Write C# program to find first and last digit of any number
  11. Write C# program to calculate product of digits of a number
  12. Write C# program to reverse a number
  13. Write C# program to calculate power using while & for loop
  14. Write C# program to find factorial of any number
  15. Write C# program to check whether a number is Armstrong number or not
  16. Write C# program to find Armstrong numbers between 1 to n
  17. Write C# program to calculate compound Interest
  18. Write C# program to check a enter number is Prime number or not using while & for loop
  19. Write C# program to check whether a number is palindrome or not
  20. Write C# program to print number in words
  21. Write C# program to find HCF of two numbers
  22. Write C# program to find LCM of two numbers

List of Switch case C# programs with an examples

  1. Write C# program to print number of days in a month using switch case
  2. Write C# program to print day of week name using switch case
  3. Write C# program to create calculator using switch Statement
  4. Write C# program to check even or odd number using switch case
  5. Write C# program to check vowel or consonant using switch case
  6. Write C# program to print gender (Male/Female) program according to given M/F.
  7. Write C# Program to find maximum number using switch case.

List of C# language array programs with an examples

  1. Write C# Program to get the Length of the Array
  2. Write C# Program to Convert a 2D Array into 1D Array
  3. Write C# Program to Demonstrate Jagged Arrays
  4. Write C# Program to Find Minimum and Maximum of Numbers
  5. Write a C# program to print all negative elements in an array
  6. Write C# program to find sum of all elements of an array
  7. Write C# program to count even and odd elements in an array
  8. Write C# program to insert an element in array
  9. Write C# program to print all unique element in an array
  10. Write C# program to sort an array in ascending order
  11. Write C# program to copy all elements of one array to another
  12. Write C# program to count number of each element in an array
  13. Write C# program to delete all duplicate elements from an array
  14. Write C# program to count total duplicate elements in an array
  15. Write C# program to merge two sorted array
  16. Write C# Program to Find the Average Values of all the Array Elements
  17. Write C# program to find reverse of an array
  18. Write a program in C# Sharp to find the second largest element in an array

All function programs in c# with an examples

  1. Write a C# program to create a user define function with parameter
  2. Write a C# program to add two numbers using function
  3. Write a C# program to create a function to input a string and count number of spaces are in the string
  4. Write a C# program to find even or odd number using function
  5. Write a C# program to create a function to calculate the sum of the individual digits of a given number
  6. Write a C# program to create a function to check whether a number is prime or not
  7. Write a C# program to create a function to display the n number Fibonacci sequence
  8. Write a C# program to create a function to swap the values of two integer numbers
  9. Write a C# program to create a recursive function to find the factorial of a given number
  10. Write a C# program to Print Binary Equivalent of an Integer using Recursion

All LINQ programs in C# with examples

  1. Write a program in C# to find the positive numbers from a list of numbers using two where conditions in LINQ Query
  2. Write a program in C# to display the name of the days of a week in LINQ Query
  3. Write a program in C# to create a list of numbers and display the numbers greater than 20 in LINQ Query
  4. Write a program in C# to find the number of an array and the square of each number in LINQ Query
  5. Write a program in C# to display the top n-th records in LINQ Query
  6. Write a program in C# to display the number and frequency of number from given array in LINQ Query
  7. Write a program in C# to display the characters and frequency of character from given string in LINQ Query
  8. Write a program in C# to find the uppercase words in a string in LINQ Query
  9. Write a program in C# to Remove Items from List using remove function by passing object in LINQ Query
  10. Write a program in C# to remove a range of items from a list by passing the start index and number of elements to remove in LINQ Query
  11. Write a program in C# to generate a Cartesian Product of two sets in LINQ Query
  12. Write a program in C# to arrange the distinct elements in the list in ascending order in LINQ Query

All String programs in C# with examples

  1. Write a C# program to accept a string from keyboard and print it
  2. Write a C# program to Separate the individual characters from a string
  3. Write a C# program to find the length of a string without using library function
  4. Write a C# program to count a total number of alphabets, digits and special characters in a string
  5. Write a C# program to print individual characters of the string in reverse order
  6. Write a C# program to copy one string to another string
  7. Write a C# program to count a total number of vowel or consonant in a string
  8. Write a C# program to find maximum occurring character in a string
  9. Write a C# program to read a string through the keyboard and sort it using bubble sort
  10. Write a C# program to sort a string array in ascending order
  11. Write a C# program to compare (less than, greater than, equal to ) two substrings
  12. Write a C# program to find the number of times a substring appears in the given string
  13. Write a C# program to check the username and password
  14. Write a C# program to read a sentence and replace lowercase characters by uppercase and vice-versa
  15. Write a C# program to check whether a given substring is present in the given string

Number pattern programs in c++ language


Star Pattern in c++ Programming language


All C++ Alphabet programs with examples


TaggedC# Basic Exercises Practice SolutionC# programming example and solutions

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more