Created
November 15, 2012 23:17
Newest Version of the harder one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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