Skip to content

Instantly share code, notes, and snippets.

Created November 15, 2012 23:17
Show Gist options
  • Save anonymous/4082266 to your computer and use it in GitHub Desktop.
Save anonymous/4082266 to your computer and use it in GitHub Desktop.
Newest Version of the harder one
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1 //this is from Deitel Exercises 6.9 – 6.12, 6.19, 6.21, 6.26
{ //To be specific, it's number 6.11
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Enter however many integers out of which you would like the smallest divined:");
int howManyInts = Convert.ToInt32(Console.ReadLine());
if (howManyInts < 1)
{
Console.WriteLine("Enter a number above zero, please!");
Console.WriteLine("Please restart the program and try again.");
}
int smallestInt = Int32.MaxValue;
for (int i = 1; i <= howManyInts; i++)
{
Console.WriteLine();
Console.WriteLine("Enter Integer:");
int smallestIntPotential = Convert.ToInt32(Console.ReadLine());
if (smallestIntPotential < smallestInt){
smallestInt = smallestIntPotential;
}
Console.WriteLine("The smallest integer is:");
Console.WriteLine(smallestInt);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment