Reverse order of strings in C#
static void Main(string[] args) { char[]your_input; Console.WriteLine("Please Enter your Name : "); string s = Console.ReadLine(); your_input = s.ToCharArray(); Array.Reverse(name); Console.WriteLine(your_input); Console.ReadLine(); }
Console Application for creating star pyramid using C# code
static void Main(string[] args) // Console Application for creating star pyramid using C# code // For value of 4 // * // * * // * * * // * * * * using System; namespace STAR { class Class1 { static void Main() { Console.WriteLine("Enter the value "); int k=int.Parse(Console.ReadLine()); int n=k-1; int x=2*(k-1)+1; for(int p=0;p<=n;p++) { for(int j=k-1;j>=0;j--) { Console.Write(" "); } for(int i=0;i<=(x-2*(k-1));i++) { if(i%2==1) { Console.Write("*"); } else { Console.Write(" "); } } Console.WriteLine(); k--; } Console.ReadLine(); } } }