This is a C# Program to generate odd numbers within a range.
This C# Program Generates Odd Numbers within a Range.
Here Enumerable.Range generates a collection of odd numbers of a specified range. It can simplify numeric lists and drop-downs in Windows Forms program.
Here is source code of the C# Program to Generate Odd Numbers within a Range. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * C# Program to Caluculate the power exponent value */ using System; using System.Collections.Generic; using System.Linq; class program { static void Main(string[] args) { IEnumerable<int> oddNums = Enumerable.Range(20, 20).Where(x => x % 2 != 0); foreach (int n in oddNums) { Console.WriteLine(n); } Console.ReadLine(); } }
This C# program generates odd numbers within a range. The Enumerable.Range generates a collection of odd numbers of a specified range. It can simplify numeric lists and drop-downs in Windows Forms program. Using foreach loop print the odd numbers in the range.
21 23 25 27 29 31 33 35 37 39
Sanfoundry Global Education & Learning Series – 1000 C# Programs.
- Get Free Certificate of Merit in C# Programming
- Participate in C# Programming Certification Contest
- Become a Top Ranker in C# Programming
- Take C# Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Buy Computer Science Books
- Apply for C# Internship
- Practice MCA MCQs
- Buy MCA Books
- Buy C# Books