using System; class MainClass { public static void Main (string[] args) { Console.WriteLine("Name" + "\t\t\t" + "Age"); Console.WriteLine("John Doe".PadRight(24) + "30"); Console.WriteLine("Jane Smith".PadRight(24) + "35"); } }
using System; using System.IO; class MainClass { public static void Main (string[] args) { string filePath = "example.txt"; using (StreamWriter writer = new StreamWriter(filePath)) { writer.WriteLine("Hello".PadRight(10) + "World"); writer.WriteLine("C#".PadRight(10) + "is awesome!"); } } }This code writes two lines of text to a file named "example.txt", where the first word in each line is aligned to the left and the second word is aligned to the right.