using System; /// Reciprocal demonstrates arithmetic /// assumed input: an integer /// guaranteed output: the number's reciprocal public class Reciprocal { public static void Main() { Console.Write("Please type a nonzero int: "); string input = Console.ReadLine(); // read a string int n = Int32.Parse(input); // convert string to int double answer = 0.0; // double means fractional num if ( n != 0 ) { answer = 1.0 / n; } // do NOT restate data type double Console.Write("1.0 / " + input + " is "); Console.WriteLine(answer); Console.ReadLine(); // wait for human to press Enter } }