Skip to main content
Commonmark migration
Source Link

##C#, 252 247 245 232 216 Bytes ##

C#, 252 247 245 232 216 Bytes

The size is pretty bad compared to the other solutions but nevertheless...

using System;using System.Linq;class p{static void Main(){var c="";var i=Console.ReadLine();var r=new Random();for(int b=0;b++<i.Count();){int d=r.Next(10);Console.Write((char)(i[b]+d));c+=d;}Console.Write("\n"+c);}}

This is my second ever answer to a codegolf and I'm quite a beginner considering C# so I'd appreciate to hear how to get it shorter :)

Ungolfed:

using System;
using System.Linq;

class p
{
    static void Main()
    {
        var c = "";
        var i = Console.ReadLine();
        var r = new Random();
        for (int b = 0; b++ < i.Count();)
        {
            int d = r.Next(10);
            Console.Write((char)(i[b] + d));
            c += d;
        }
        Console.Write("\n" + c);
    }
}
  • Saved 5 Bytes thanks to @FryAmTheEggman
  • Saved 2 Bytes thanks to @theLambGoat
  • Saved 7 Bytes by removing static from class p
  • Saved 24 Bytes thanks to @milk

##C#, 252 247 245 232 216 Bytes ##

The size is pretty bad compared to the other solutions but nevertheless...

using System;using System.Linq;class p{static void Main(){var c="";var i=Console.ReadLine();var r=new Random();for(int b=0;b++<i.Count();){int d=r.Next(10);Console.Write((char)(i[b]+d));c+=d;}Console.Write("\n"+c);}}

This is my second ever answer to a codegolf and I'm quite a beginner considering C# so I'd appreciate to hear how to get it shorter :)

Ungolfed:

using System;
using System.Linq;

class p
{
    static void Main()
    {
        var c = "";
        var i = Console.ReadLine();
        var r = new Random();
        for (int b = 0; b++ < i.Count();)
        {
            int d = r.Next(10);
            Console.Write((char)(i[b] + d));
            c += d;
        }
        Console.Write("\n" + c);
    }
}
  • Saved 5 Bytes thanks to @FryAmTheEggman
  • Saved 2 Bytes thanks to @theLambGoat
  • Saved 7 Bytes by removing static from class p
  • Saved 24 Bytes thanks to @milk

C#, 252 247 245 232 216 Bytes

The size is pretty bad compared to the other solutions but nevertheless...

using System;using System.Linq;class p{static void Main(){var c="";var i=Console.ReadLine();var r=new Random();for(int b=0;b++<i.Count();){int d=r.Next(10);Console.Write((char)(i[b]+d));c+=d;}Console.Write("\n"+c);}}

This is my second ever answer to a codegolf and I'm quite a beginner considering C# so I'd appreciate to hear how to get it shorter :)

Ungolfed:

using System;
using System.Linq;

class p
{
    static void Main()
    {
        var c = "";
        var i = Console.ReadLine();
        var r = new Random();
        for (int b = 0; b++ < i.Count();)
        {
            int d = r.Next(10);
            Console.Write((char)(i[b] + d));
            c += d;
        }
        Console.Write("\n" + c);
    }
}
  • Saved 5 Bytes thanks to @FryAmTheEggman
  • Saved 2 Bytes thanks to @theLambGoat
  • Saved 7 Bytes by removing static from class p
  • Saved 24 Bytes thanks to @milk
deleted 4 characters in body
Source Link

##C#, 252 247 245 232232 216 Bytes ##

The size is pretty bad compared to the other solutions but nevertheless...

using System;using System.Linq;class p{static void Main(){var c="";char[]i=Consolec="";var i=Console.ReadLine().ToCharArray();var r=new Random();for(int b=0;b++<i.Count();){int d=r.Next(10);Console.Write((char)(i[b]+d));c+=d;}Console.Write("\n"+c);}}

This is my second ever answer to a codegolf and I'm quite a beginner considering C# so I'd appreciate to hear how to get it shorter :)

Ungolfed:

using System;
using System.Linq;

class p
{
    static void Main()
    {
        var c = "";
        char[]var i = Console.ReadLine().ToCharArray();
        var r = new Random();
        for (int b = 0; b++ < i.Count();)
        {
            int d = r.Next(10);
            Console.Write((char)(i[b] + d));
            c += d;
        }
        Console.Write("\n" + c);
    }
}
  • Saved 5 Bytes thanks to @FryAmTheEggman
  • Saved 2 Bytes thanks to @theLambGoat
  • Saved 7 Bytes by removing static from class p
  • Saved 624 Bytes thanks to @milk

##C#, 252 247 245 232 Bytes ##

The size is pretty bad compared to the other solutions but nevertheless...

using System;using System.Linq;class p{static void Main(){var c="";char[]i=Console.ReadLine().ToCharArray();var r=new Random();for(int b=0;b++<i.Count();){int d=r.Next(10);Console.Write((char)(i[b]+d));c+=d;}Console.Write("\n"+c);}}

This is my second ever answer to a codegolf and I'm quite a beginner considering C# so I'd appreciate to hear how to get it shorter :)

Ungolfed:

using System;
using System.Linq;

class p
{
    static void Main()
    {
        var c = "";
        char[] i = Console.ReadLine().ToCharArray();
        var r = new Random();
        for (int b = 0; b++ < i.Count();)
        {
            int d = r.Next(10);
            Console.Write((char)(i[b] + d));
            c += d;
        }
        Console.Write("\n" + c);
    }
}
  • Saved 5 Bytes thanks to @FryAmTheEggman
  • Saved 2 Bytes thanks to @theLambGoat
  • Saved 7 Bytes by removing static from class p
  • Saved 6 Bytes thanks to @milk

##C#, 252 247 245 232 216 Bytes ##

The size is pretty bad compared to the other solutions but nevertheless...

using System;using System.Linq;class p{static void Main(){var c="";var i=Console.ReadLine();var r=new Random();for(int b=0;b++<i.Count();){int d=r.Next(10);Console.Write((char)(i[b]+d));c+=d;}Console.Write("\n"+c);}}

This is my second ever answer to a codegolf and I'm quite a beginner considering C# so I'd appreciate to hear how to get it shorter :)

Ungolfed:

using System;
using System.Linq;

class p
{
    static void Main()
    {
        var c = "";
        var i = Console.ReadLine();
        var r = new Random();
        for (int b = 0; b++ < i.Count();)
        {
            int d = r.Next(10);
            Console.Write((char)(i[b] + d));
            c += d;
        }
        Console.Write("\n" + c);
    }
}
  • Saved 5 Bytes thanks to @FryAmTheEggman
  • Saved 2 Bytes thanks to @theLambGoat
  • Saved 7 Bytes by removing static from class p
  • Saved 24 Bytes thanks to @milk
added 118 characters in body
Source Link

##C#, 252 247247 245 232 Bytes ##

The size is pretty bad compared to the other solutions but nevertheless...

using System;using System.Linq;static classLinq;class p{static void Main(){stringvar c="";char[]i=Console.ReadLine().ToCharArray();Random;var r=new Random();for(int b=0;b++<i.Count();){int d;Console.Write((char)(i[b]+(d=r.Next(10);Console.Write((char)(i[b]+d));c+=d;}Console.Write("\n"+c);}}

This is my second ever answer to a codegolf and I'm quite a beginner considering C# so I'd appreciate to hear how to get it shorter :)

Ungolfed:

using System;
using System.Linq;

static class p
{
    static void Main()
    {
        stringvar c = "";
        char[] i = Console.ReadLine().ToCharArray();
        Randomvar r = new Random();
        for (int b = 0; b++ < i.Count();)
        {
            int d;d = r.Next(10);
            Console.Write((char)(i[b] + (d = r.Next(10))));
            c += d;
        }
        Console.Write("\n" + c);
    }
}

Saved 5 Bytes thanks to @FryAmTheEggman

  • Saved 5 Bytes thanks to @FryAmTheEggman
  • Saved 2 Bytes thanks to @theLambGoat
  • Saved 7 Bytes by removing static from class p
  • Saved 6 Bytes thanks to @milk

##C#, 252 247 Bytes ##

The size is pretty bad compared to the other solutions but nevertheless...

using System;using System.Linq;static class p{static void Main(){string c="";char[]i=Console.ReadLine().ToCharArray();Random r=new Random();for(int b=0;b++<i.Count();){int d;Console.Write((char)(i[b]+(d=r.Next(10))));c+=d;}Console.Write("\n"+c);}}

This is my second ever answer to a codegolf and I'm quite a beginner considering C# so I'd appreciate to hear how to get it shorter :)

Ungolfed:

using System;
using System.Linq;

static class p
{
    static void Main()
    {
        string c = "";
        char[] i = Console.ReadLine().ToCharArray();
        Random r = new Random();
        for (int b = 0; b++ < i.Count();)
        {
            int d;
            Console.Write((char)(i[b] + (d = r.Next(10))));
            c += d;
        }
        Console.Write("\n" + c);
    }
}

Saved 5 Bytes thanks to @FryAmTheEggman

##C#, 252 247 245 232 Bytes ##

The size is pretty bad compared to the other solutions but nevertheless...

using System;using System.Linq;class p{static void Main(){var c="";char[]i=Console.ReadLine().ToCharArray();var r=new Random();for(int b=0;b++<i.Count();){int d=r.Next(10);Console.Write((char)(i[b]+d));c+=d;}Console.Write("\n"+c);}}

This is my second ever answer to a codegolf and I'm quite a beginner considering C# so I'd appreciate to hear how to get it shorter :)

Ungolfed:

using System;
using System.Linq;

class p
{
    static void Main()
    {
        var c = "";
        char[] i = Console.ReadLine().ToCharArray();
        var r = new Random();
        for (int b = 0; b++ < i.Count();)
        {
            int d = r.Next(10);
            Console.Write((char)(i[b] + d));
            c += d;
        }
        Console.Write("\n" + c);
    }
}
  • Saved 5 Bytes thanks to @FryAmTheEggman
  • Saved 2 Bytes thanks to @theLambGoat
  • Saved 7 Bytes by removing static from class p
  • Saved 6 Bytes thanks to @milk
added 42 characters in body
Source Link
Loading
Source Link
Loading