Programming &blog Virgo-using C # to find prime numbers within 100

Source: Internet
Author: User

Using System;
Namespace Loops
{
Class Program
{
static void Main (string[] args)
{
/* local variable definition */
int I, J;
for (i = 2; i <; i++)
{
for (j = 2; J <= I/j; j + +)
if ((i% j) = = 0) break;//If found, it is not prime
if (J > (i/j))
Console.WriteLine ("{0} is prime number/n", I);
}
Console.ReadLine ();
}
}
}

The first blog, but also the first contact with C #, before the school on the programming of the content of C language, but has not been exposed to these three years, and now re-start learning programming, hope everything is not too late. Let the blog park to record my and C # growth path it.

Now just remember to learn C before writing the method of seeking prime numbers, but that method of efficiency is simply low to explode, today in the C # program, see a very fast method, just beginning also leng a bit, although in other people's view should be a very simple method, but I do not, so still want to lose the slowly learn.

Learn to ask for a prime number today.

Don't forget beginner's mind

Programming &blog Virgo-using C # to find prime numbers within 100

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.