loop with letter char as the control variable : for : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » for »

 

loop with letter char as the control variable








    
 
using System;
using System.Collections.Generic;
using System.Text;

class Program {
    static void Main(string[] args) {
        string greetingText = "www.navioo.com";

        for (int i = (int)'z'; i >= (int)'a'; i--) {
            char old1 = (char)i;
            char new1 = (char)(i + 1);
            greetingText = greetingText.Replace(old1, new1);
        }

        for (int i = (int)'Z'; i >= (int)'A'; i--) {
            char old1 = (char)i;
            char new1 = (char)(i + 1);
            greetingText = greetingText.Replace(old1, new1);
        }

        Console.WriteLine("Encoded:\n" + greetingText);
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» for