Tag Archives: c

Click event of a Button on Click event of another button in C#

The following code example demonstrates how to call the Click event of a Button on Click event of another button. The following code assumes that two Button and one TextBox controls have been instantiated on a form. On the click of the button1, we will generate the click event of the button2 if the the value of the textbox1 is numeric. Continue reading Click event of a Button on Click event of another button in C#

Get all prime numbers up to given number using Sieve of Eratosthenes algorithm in c#

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. For example, 5 is prime because only 1 and 5 divide it, whereas 6 is composite because it has the divisors 2 and 3 in addition to 1 and 6. And now if i say that find the all prime numbers up to 6 then there are three numbers 2,3 and 5. Continue reading Get all prime numbers up to given number using Sieve of Eratosthenes algorithm in c#