Tech Study

Write C# program to right rotate an array

Introduction

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.

using System;
class Program
{   
    static void Main()
    {
        int[] numbers = { 1, 2, 8 };
        Console.WriteLine("\nArray1: [{0}]", string.Join(", ", numbers));
        var temp = numbers[0];
        for (var i = 0; i < numbers.Length - 1; i++)
        {
            numbers[i] = numbers[i + 1];
        }
        numbers[numbers.Length - 1] = temp;
        Console.WriteLine("\nAfter rotating array becomes: [{0}]", string.Join(", ", numbers));
 
        Console.ReadLine();
    }
 
}

Result

Python Examples

Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …

Read more

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more