954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

looping statement help!

help!....
can you give me a statement of looping that use for loop, while, and do while loop at the same time...
and if you can answer the statement it will be more welcome..
thank u ...
peace!

CloudZELL91
Newbie Poster
7 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
 
for (int x = 2; x < 100; x++) {
    while (x % 2 != 0) {
        int y = 2;
        bool prime = true;
        do {
            if (x % y == 0) {
                prime = false;
                break;
            }
            y++;
         } while (y < x);
         if (prime) Console.WriteLine("{0} is prime!", x);
    }
}
Momerath
Nearly a Senior Poster
3,384 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You