Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Problems with my number program c#

$
0
0

Hello

i am having troubel with the following code and would like it to return a number's factors but i am having multiplee weird errors

using System;

namespace Algorythm_test
{
	class Program
	{
		public static void Main(string[] args)
		{
			System.Console.WriteLine("Emersont1's Factor finder\n Please Enter your Number to check factors");
			int Lim = Convert.ToInt32(Console.Read());
				System.Console.WriteLine("The Number " + Lim + " has " + Factors(Lim) + " factors");
		}

 
			public int Factors(int value)
			{
    		int Secondnum = 1;
    		While Secondnum <=value;
    		{
    			if (value % Secondnum == 0)
       				{
          				Factors++;
       				}
      			Secondnum++;
    		}
    return Factors;
}
		}
	}

Thank you for any support

Emersont1


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>