Suppose you have the string: Welcome to C# programming.
Then how can we print: ***Welcome to C# programming### ?
Use PadLeft to append string to left.
using System; public class MainClass{ public static void Main(String[] argv){ string welcome = "Welcome to C# programming"; string welcome1=welcome.PadLeft(welcome.Length+3,'*'); string welcome2= welcome1.PadRight(welcome1.Length+3,'#'); Console.WriteLine(welcome2);// w w w.j ava 2 s. c om } }