using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication11
{
class Program0
{
static void Main(string[] args)
{
lable:
Console.WriteLine("");
int naonao = 0;
int i = 0;
int n = 0;
int u = 0;
// Console.WriteLine("请输入查询范围因子数");
lable2:
try
{
n = Convert.ToInt32(Console.ReadLine());
}
catch
{
// Console.WriteLine("请正确输入查询范围因子数");
goto lable2;
}
if (n % 2 == 1)
{
for (int k = 1; k <= 100000; k++)
{
int m = 0;
u = k * k;
for (int j = 1; j <= u; j++)
{
if (u % j == 0)
{
m = m + 1;
}
}
if (m == n)
{
naonao = k * k;
goto b;
}
if (k == 100000)
{
u = k * k;
goto lable3;
break;
}
}
}
else
{
for (i = 2; i < 1000000000; i++)
{
if (!Zhi(i))
{
int m = 0;
for (int j = 1; j <= i; j++)
{
if (i % j == 0)
{
m = m + 1;
}
}
if (m == n)
{
naonao = i;
goto b;
}
}
}
}
b:
if (naonao != 0)
{
Console.WriteLine("七夕情人节礼物啊");
Console.WriteLine("具有{0}个因数的数为{1}", n, naonao);
int s = -1;
Console.WriteLine("它的因子分别是:");
for (int j = 1; j <= naonao; j++)
{
if (naonao % j == 0)
{
s = ++s;
if (s % 10 == 0)
{
Console.WriteLine();
}
Console.Write(" {0}", j);
}
}
Console.WriteLine("");
}
else
{
Console.WriteLine("该程序范围内无{0}个因数的合数", n);
Console.WriteLine("");
}
lable3:
if (u >= 1000000000)
{
Console.WriteLine("该程序在100亿以内范围内无{0}个因数的合数", n);
Console.WriteLine("");
}
goto lable;
Console.ReadKey();
}
public static bool Zhi(int a)
{
for (int i = 2; i < a; i++)
{
if (a % i == 0)
{
return false;
break;
}
}
return true;
}
}
}
对于一个刚接触编程的学生,单身狗在七夕是找一个合数玩吧