1: using System;
2: namespace st
3: {
4: class HighestFactor
5: {
6: static void Main()
7: {
8: Console.Write("Enter a number :");
9: string input = Console.ReadLine();
10: int num = Int32.Parse(input);
11: for (int i = num / 2; i > 0; i--)
12: {
13: if (num % i == 0)
14: {
15: Console.WriteLine("Highest factor for {0} is {1}", num, i);
16: break;
17: }
18: } // for
19: } // main
20: } // class
21: } // namespace
Technorati Tags: C#
Comments
Post a Comment