Code Challenge: "Hello, World"

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

38 Replies - 13366 Views - Last Post: 23 October 2014 - 10:45 PM

#31 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1623
  • View blog
  • Posts: 5,709
  • Joined: 03-August 09

Re: Code Challenge: "Hello, World"

Posted 15 May 2013 - 09:03 AM

ya, that means I missed something :P
Was This Post Helpful? 0
  • +
  • -

#32 anhtai116  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 07-June 13

Re: Code Challenge: "Hello, World"

Posted 07 June 2013 - 09:58 AM

Let do something with OOP
Spoiler

This post has been edited by Skydiver: 16 June 2014 - 09:15 PM
Reason for edit:: Put code in spoiler tags to keep challenge fresh for everybody.

Was This Post Helpful? 0
  • +
  • -

#33 hemantwithu  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 5
  • View blog
  • Posts: 31
  • Joined: 18-October 11

Re: Code Challenge: "Hello, World"

Posted 29 May 2014 - 11:44 PM

It's a nice challenge to compete . Here is my code
Spoiler

This post has been edited by Skydiver: 16 June 2014 - 09:14 PM
Reason for edit:: Put code in spoiler tags to keep challenge fresh for everybody.

Was This Post Helpful? 0
  • +
  • -

#34 Urganot  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-June 14

Re: Code Challenge: "Hello, World"

Posted 16 June 2014 - 06:00 AM

Cool Challenge
Spoiler

Was This Post Helpful? 0
  • +
  • -

#35 Xaos  Icon User is offline

  • D.I.C Regular

Reputation: 72
  • View blog
  • Posts: 363
  • Joined: 20-November 13

Re: Code Challenge: "Hello, World"

Posted 16 June 2014 - 06:15 AM

Heh, my first coding challenge on the site. 'Twas interesting!
Spoiler

This post has been edited by Skydiver: 16 June 2014 - 09:12 PM
Reason for edit:: Put code in spoiler tags to keep challenge fresh for everybody.

Was This Post Helpful? 0
  • +
  • -

#36 JasenS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 26-August 14

Re: Code Challenge: "Hello, World"

Posted 28 August 2014 - 04:53 AM

Nice little thought provoking exercise. Here's what I just jotted down this morning.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace helloworldloop
{
    class Program
    {
       static int count = 0;
        
    
        static void Main(string[] args)
        {
            hello();
        }

       static void hello()
        {
            if (count < 1001)
            {
                Console.WriteLine("Hello World!!!!" + count.ToString());
                count++;
                hello();
            }
            else
            {
                Console.WriteLine("Welp, we're at 1000");
            }
        }
        
    

    }
}






It's almost Friday, so here we are. :D
Was This Post Helpful? 0
  • +
  • -

#37 cruse07  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 14-October 14

Re: Code Challenge: "Hello, World"

Posted 14 October 2014 - 07:46 AM

class Program
{
static int x = 0;
Program()
{
Console.WriteLine(x+": HELLO WORLD",++x);
if (x == 1000)
{
// System.Environment.Exit(0);
Console.ReadKey();
return;
}
new Program();

}

static void Main(string[] args)
{
new Program();
Console.ReadKey();

}
}
Was This Post Helpful? 0
  • +
  • -

#38 Chepetico  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-October 14

Re: Code Challenge: "Hello, World"

Posted 23 October 2014 - 08:21 PM

Hey, great challenge! Here is my answer:

using System;

namespace HelloWorldRecursion
{
    class Program
    {
        static void Main(string[] args)
        {
            int numberOfIterations = randomNumberGenerator.Next(1001);

            string numberOfTimes = numberOfIterations == 1 ? "time" : "times";

            Console.WriteLine("Hello World Repeated Using Recursion!\n");

            Console.WriteLine("Hello World will be repeated " + 
                numberOfIterations.ToString() + " " + numberOfTimes + ".\n");

            Console.WriteLine("Press 'Enter' to continue.\n");

            Console.ReadLine();

            int count = 0;

            RecursiveDisplayOfHelloWorld(ref count, ref numberOfIterations);

            Console.WriteLine("\nPress 'Enter' to continue.\n");

            Console.ReadLine();
        }

        public static Random randomNumberGenerator = new Random();

        public static void RecursiveDisplayOfHelloWorld(ref int count, ref int numberOfIterations)
        {
            if (count < numberOfIterations)
            {
                count++;

                Console.WriteLine(count.ToString() + " Hello World!");

                RecursiveDisplayOfHelloWorld(ref count, ref numberOfIterations);
            }
            else
            {
                return;
            }
        }
    }
}


Was This Post Helpful? 0
  • +
  • -

#39 Chepetico  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-October 14

Re: Code Challenge: "Hello, World"

Posted 23 October 2014 - 10:45 PM

Actually,

int numberOfIterations = randomNumberGenerator.Next(1001);



Should be

int numberOfIterations = randomNumberGenerator.Next(1, 1000);



and the final

Console.WriteLine("\nPress 'Enter' to continue.\n");



Should be

Console.WriteLine("\nPress 'Enter' to exit.\n");


Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3