Posts

Fibonacci Series in C#

In the case of Fibonacci series, the next number is the sum of the previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21 etc. The first two numbers of Fibonacci series are 0 and 1. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 {     class Program     {         static void Main(string[] args)         {             int val1 = 0, val2 = 1, val3, i, number;             Console.WriteLine("Please Enter any number");             number = int.Parse(Console.ReadLine());             Console.WriteLine(val1 + " " + val2);             for (i=2;i<=number;i++)             {                 val3 =...

Prime Number Program in C#

Prime number is a number that is greater than 1 and divided by 1 or itself. In other words, prime numbers can't be divided by other numbers than itself or 1. For example 2, 3, 5, 7, 11, 13, 17, 19, 23.... are the prime numbers. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 {     class Program     {         static void Main(string[] args)         {             int number, i, m = 0, flag = 0;             Console.WriteLine("PLEASE ENTER THE NUMBER TO CHECK PRIME NUMBER");             number = int.Parse(Console.ReadLine());             m = number / 2;             for(i=2;i<=m;i++)             {           ...

C# program to print even numbers

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 {     class Program     {         static void Main(string[] args)         {             Console.WriteLine("Please enter number");             int number = 0;             number = int.Parse(Console.ReadLine());             for (int i = 0; i <= number; i++)             {                 if (i % 2 == 0)                 {                     Console.WriteLine(i);                     Console.WriteLine("even number");       ...

how to get userdetails from Active Directory based on username using asp.net

Introduction: Here I will explain how to get userdetails from Active directory based on username using asp.net Description:  I got requirement like to get user details from Active directory based on username.  For that first create one new website after that right click on website and select  Add Reference  option after that select  System.DirectoryServices  from .NET tab and click ok now  directory services reference has added to our application do you know why we have added this directory service to our application because by using this service we can get userdetails from Active directory. After that design your aspx page like this <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="aspdotnet1.WebForm1" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server">     <title></title> ...