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

namespace yeah
{
    class Program
    {
        static void Main(string[] args)
        {
            string name;
            System.Console.WriteLine("What is your name:");
            name = System.Console.ReadLine();
            System.Console.WriteLine("the name is " + name + "!!!!!!");
            System.Console.Read();
            System.Console.Clear();
            System.Console.WriteLine("wait there's more! ");
            System.Console.Read();
            System.Console.WriteLine("Simple Test ");
            System.Console.Read();
            System.Console.Clear();

            int a = 0;
            int b = 0;
            int c = 0;
            System.Console.WriteLine("Give me your first input: ");
            a = System.Convert.ToInt32(Console.ReadLine());
            System.Console.WriteLine("Give me your Second input: ");
            b = System.Convert.ToInt32(Console.ReadLine());
            c = System.Convert.ToInt32(Console.ReadLine());
            c = a + b;

            System.Console.WriteLine("ang sagot sa " + a + "at saka sa " + b + "ay...." + c + "!!");
            System.Console.Read();


            {
            }
        }
    }
}








I dont know why I cant enter number. :( Im sorry Im too beginner for C#.

To start this line is redundant:

c = System.Convert.ToInt32(Console.ReadLine());

As it has no bearing on the result of the codeand prompts an extra readline.

Secondly, as you already have:

using System;

You don't need to preface everything with System.

Third, prior to the end of your Main procedure you have an extra pair of braces that have no purpose and can be removed.

How I would have written it is as follows (however, I'm getting a nasty little glitch which I've seen before and can't explain where it doubles up the 2 input requests and only accepts the 2nd input):

static void Main(string[] args)
        {
            string name;
            Console.WriteLine("What is your name:");
            name = System.Console.ReadLine();
            Console.WriteLine("the name is " + name + "!!!!!!");
            Console.Read();
            Console.Clear();
            Console.WriteLine("wait there's more! ");
            Console.Read();
            Console.WriteLine("Simple Test ");
            Console.Read();
            Console.Clear();

            string a = "";
            string b = "";
            int c = 0;
            Console.WriteLine("Give me your first input: ");
            a = Console.ReadLine();
            System.Console.WriteLine("Give me your Second input: ");
            b = Console.ReadLine();
            c = Convert.ToInt16(a) + Convert.ToInt16(b);

            Console.WriteLine("ang sagot sa " + a + "at saka sa " + b + "ay...." + c.ToString() + "!!");
            Console.Read();
        }

For some reason the compiler is reading the whole segment for the first and second input together and only accepting input towards 'b' but I'm sure that's a glitch in the compiler and not related to the code as there's no logical reason for it from what I can see :twisted:

What I was noticing is when I tried to execute your initial code because you were doing the conversion to INT 'on-the-fly' it didn't like that and was throwing errors. So I simply changed it to input as string and convert to int at the time of the calculation.

Hope this helps though. Please remember to mark as solved once your issue is resolved.

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.