using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;  //first step add this 

namespace Project4
{
    class Program
    {
        static void Main(string[] args)
        {
            Random random = new Random();
            {
                int m = 0, j = 0, k = 0;
                Console.WriteLine("Enter Statet(m or j or  k)");
                String state = Console.ReadLine();
                {
                    m = random.Next(1,20);
                    Console.WriteLine(m + "\t" + m);
                    }
                if (state == "m")
                {
                    m = m + 1;
                }
                if (state == "j")
                {
                    j = j + 1;
                }
                else
                {
                    if (state == "k")
                        k = k + 1;
                }

                Console.WriteLine("The number of m is" + m);
                Console.WriteLine("The number of j is" + j);
                TextWriter frenchtoast = new StreamWriter("state.txt");
                frenchtoast.WriteLine(DateTime.Now);
                int rno = Convert.ToInt16(Console.ReadLine());

                switch (rno)
                {
                    case 1:
                        Console.WriteLine("California");
                        break;
                    case 2:
                        Console.WriteLine("Ohio");
                        break;
                    case 3:
                        Console.WriteLine("North Carolina");
                        break;
                }
            } string dummy = Console.ReadLine();
        }
    }
}

I am trying here is where I'm at now:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;  //first step add this

namespace Project_4
{
    class Program
    {
        static void Main(string[] args)
        {
            Random random = new Random();
            int rno = 0;
            int m = 0;
            int j = 0;
            int k = 0;
            for (int i = 1; i <= 20; i++)
            {
                String state = Console.ReadLine();
                TextWriter frenchtoast = new StreamWriter("state.txt");
                frenchtoast.WriteLine(DateTime.Now);
                frenchtoast.Close();
                {
                    rno = random.Next(1, 6);
                    Console.WriteLine(i + "\t" + rno);
                }
                {
                    switch (rno)
                    {
                        case 1:
                            Console.WriteLine("California");
                            break;
                        case 2:
                            Console.WriteLine("Ohio");
                            break;
                        case 3:
                            Console.WriteLine("North Carolina");
                            break;
                            if (state == "m")
                            {

                                m = m + 1;
                            }
                            if (state == "j")
                            {
                                j = j + 1;
                            }
                            else
                            {
                                if (state == "k")
                                    k = k + 1;
                            }

                            Console.WriteLine("The State is California" + m);
                            Console.WriteLine("The State is Ohio" + j);
                            Console.WriteLine("The State is North Carolina" + k);
                    }
                }

            } string dummy = Console.ReadLine();
        }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.