Posts

Showing posts from May, 2020

Write a program to print the Fibonacci series in c# using Recursion.

Image
Write a program to print the Fibonacci series in c# using Recursion. class Fibonacci     {         // Using Recursion:         public static int FibonacciSeries( int n)         {            //To return the first & second Fibonacci number             if (n == 0 || n == 1) return n;                                return FibonacciSeries(n - 1) + FibonacciSeries(n - 2);         }         public static void Main( string [] args)         {             Console .Write( "Enter the leng...

Write a program to print Fibonacci series in c#.

Image
Write a program to print the Fibonacci series in c#. class Program     {         static int FibonacciNumber( int number)         {             int firstnumber = 0, secondnumber = 1, result = 0;             if (number == 0 || number == 1) return number; //Return the first & second Fibonacci number               for ( int i = 2; i <= number; i++)             {                 result = firstnumber + secondnumber;                 firstnumber = secondnumber;      ...

Write a program to print factorial of a number using recursion.

Image
Write a program to print the factorial of a number using recursion. class Program     {        // Using Recursion:         public static double factorial( int number)         {             if (number == 1)                 return 1;             else                  return number * factorial(number - 1);         }         static void Main( string [] args)         {             Console .WriteLine( "Enter the Number" );  ...
Image
Write a program to print the factorial of a number. class Program     {         static void Main( string [] args)         {             int num, fact;             Console .WriteLine( "Enter the Number" );             num = int .Parse( Console .ReadLine());             fact = num;             for ( int i = num - 1; i >= 1; i--)             {                 fact = fact * i;             }    ...

SOLID Design Principles in C#

Image
WHAT IS SOLID principles: : ü    SOLID is an acronym of 5 design principles. ü    It is foundations of good software design. ü    These  SOLID principles were introduced by  Robert C. Martin , also known as  Uncle Bob . ü    Help developer to write F lexible , Scalable , M aintainable , & R eusable code.