Results 1 to 14 of 14

Thread: C# Question

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Answers
    1

    C# Question

    How can i print on screen, a word in reverse example
    abc to read cba


  2. #2
    Junior Member
    Join Date
    Jan 2009
    Answers
    1

    Re: C# Question

    hi rokello
    i know that Stack is using "LIFO" : Last In First Out" , So have u try using stacks ?
    im not sure abt my answer coz i didnt try it its a suggestion..
    hope its helpful , im still learning


  3. #3
    Junior Member
    Join Date
    Feb 2009
    Answers
    1

    Re: C# Question

    string word = "test";
    for (int i = 0; i < = word.Length/2; i++)
    {
    char c = word[i];
    word[i] = word[word.Length - 1 - i];
    word[word.Length - 1 - i] = c;
    }


  4. #4
    Junior Member
    Join Date
    Feb 2009
    Answers
    4

    Re: C# Question

    simply u can use loop for this & othrer option u can use the concept of substring


  5. #5
    Junior Member
    Join Date
    May 2008
    Answers
    3

    Re: C# Question

    class Program
    {
    static void Main(string[] args)
    {
    string str = "string";
    char[] chararray = str.ToCharArray();
    int length = chararray.GetLength(0);
    for (int i = 0; i <= length / 2; i++, length--)
    {
    char x;
    x = str[i];
    chararray[i] = chararray[length-1];
    chararray[length-1] = x;

    }
    Console.WriteLine("{0}",new string(chararray).ToUpper());

    Console.ReadLine();

    }


  6. #6

    Re: C# Question

    C# expressed edition use The MssageBox.Show( ) method to show the message.

    Last edited by Sr.Malkiat Siingh Rana; 08-28-2009 at 01:16 AM.

  7. #7
    Junior Member
    Join Date
    Sep 2009
    Answers
    1

    Re: C# Question

    //This Code Usefull in Asp.net using C#

    protected void Page_Load(object sender, EventArgs e)
    {
    string StrName = "Mukesh";
    int i;
    String Show="";
    String Show1 = "";

    for (i = 0; i < StrName.Length ; i++ )
    {

    Show = StrName[StrName.Length -1 - i].ToString();
    Show1 = Show1 + Show;

    }
    Response.Write(Show1);
    }

    Last edited by mukesh55048; 09-15-2009 at 09:06 AM.

  8. #8
    Junior Member
    Join Date
    Mar 2008
    Answers
    2

    Re: C# Question

    string word = "seenu";
    for (int i = word.Length-1; i >= 0; i--)
    {
    Console.Write(word[i]); // or Response.Write(word[i]);
    }

    hope this will be usefull for u all......


  9. #9
    Banned
    Join Date
    Oct 2009
    Answers
    6

    Re: C# Question

    full program

    // program for building mirror image of words
    using System;



    class Program
    {
    public static void Main()
    {
    string x;
    Console.WriteLine("enter the name u want to write in mirror language");
    x = Console.ReadLine();
    string StrName = x;
    int i;
    String Show = "";
    String Show1 = "";

    for (i = 0; i < StrName.Length; i++)
    {

    Show = StrName[StrName.Length - 1 - i].ToString();
    Show1 = Show1 + Show;


    }

    Console.WriteLine(Show1);
    }
    }

    Last edited by rjroking; 10-18-2009 at 04:05 AM.

  10. #10
    Junior Member
    Join Date
    Nov 2009
    Answers
    1

    Smile Re: C# Question

    class Program
    {
    public static void Main()
    {
    string inputString = "test";
    char[] stringArray = inputString.ToCharArray();
    Array.Reverse(stringArray);
    Console.WriteLine(Convert.ToString(stringArray));
    }
    }


  11. #11
    Junior Member
    Join Date
    Sep 2009
    Answers
    1

    Wink Re: C# Question

    there is an function called "string.reverse()"......you can use this to reverse your string....

    --Munna


  12. #12
    Junior Member
    Join Date
    Feb 2010
    Answers
    1

    Re: C# Question

    //This is the easiest way to reverse a string by Sreenivasulu

    using System;


    namespace Test1
    {
    class Program
    {
    static void Main(string[] args)
    {
    string str = "reverse";
    for (int i = str.Length-1; i >= 0; i--)
    Console.Write(str[i]);
    }
    }
    }

    -Moynul


  13. #13
    Junior Member
    Join Date
    Feb 2010
    Answers
    5

    Re: C# Question

    Could not able to find that one, can you provide more information ?

    Quote Originally Posted by munnamia View Post
    there is an function called "string.reverse()"......you can use this to reverse your string....

    --Munna



  14. #14
    Junior Member
    Join Date
    Jul 2010
    Answers
    1

    Re: C# Question

    Count no of word in passage


  15.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact