Sunday, August 23, 2020

Odd and Even Numbers in C#

 I wrote this simple program using C# programming language to ask the user to give a number and then the program will check and determine whether the given number is an odd or even number.

I am currently accepting programming work inventory system, enrollment system, accounting system, point of sale, school programming assignments and projects, payroll system, information system, website design and development using WordPress, IT projects, school and application development, programming projects, thesis, and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360. My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.

Here in Bacolod City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com


Sample Program Output


Program Listing

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;


namespace Odd_and_Even_Numbers

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }


        private void button3_Click(object sender, EventArgs e)

        {

            Application.Exit();

        }


        private void button1_Click(object sender, EventArgs e)

        {

            int a = 0;


            a = Convert.ToInt32(textBox1.Text);




            if (a % 2 == 0)


            {


                MessageBox.Show("The given number " + a + " is a Even Number.",


                 "The Result");


            }

            else


            {




                MessageBox.Show("The given number " + a + " is a Odd Number.",


                 "The Result");


            }



        }


        private void button2_Click(object sender, EventArgs e)

        {

            textBox1.Text = "";

            textBox1.Focus();

        }

    }

}




No comments:

Post a Comment