0

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!

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Momerath
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);
    }
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.