Skip to content

Instantly share code, notes, and snippets.

@dabit
Forked from anonymous/gist:3791655
Created September 28, 2012 16:55
Show Gist options
  • Save dabit/3800937 to your computer and use it in GitHub Desktop.
Save dabit/3800937 to your computer and use it in GitHub Desktop.
SG codigo 1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SG___Code_1
{
class Program
{
static void Main(string[] args)
{
int a = 0;
int b = 0;
if (args.Length == 2)
{
try
{
a = Convert.ToInt32(args[0]);
}
catch (Exception e)
{
System.Console.WriteLine("Error en el primer parametro.");
System.Console.WriteLine("El programa recibe dos parametros enteros, ejemplo sgc1 1980 2012");
Environment.Exit(0);
}
try
{
b = Convert.ToInt32(args[1]);
}
catch (Exception e)
{
System.Console.WriteLine("Error en el segundo parametro.");
System.Console.WriteLine("El programa recibe dos parametros enteros, ejemplo sgc1 1980 2012");
Environment.Exit(0);
}
for (int i = a; i <= b; i++)
{
char[] c = i.ToString().ToCharArray();
if (c[0] != c[1] && c[0] != c[2] && c[0] != c[3] &&
c[1] != c[2] && c[1] != c[3] &&
c[2] != c[3])
{
System.Console.WriteLine(i);
}
}
}
else
{
System.Console.WriteLine("El programa recibe dos parametros enteros, ejemplo sgc1 1980 2012");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment