-
-
Save dabit/3800937 to your computer and use it in GitHub Desktop.
SG codigo 1
This file contains 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 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