6
Answers

printing prime numbers sequence ??

SUNIL GUTTA

SUNIL GUTTA

11y
1.5k
1
Hie 

Please do check what wrong in my code i hope everything right .. but on console its just displaying one single value o/p i.e 13 .. after i press enter key its displaying next prime upon each pres .. y it is going n like this ... 

using System;
using System.Collections.Generic;
using System. Linq;
using System.Text;


namespace ConsoleApplication2
{
    class Program
    {
        static void Main()

        {
            for (int i = 3; i < 50;i++ )
            {
                if (i % 2 == 0)
                continue ;
                if (i % 3 == 0)
                    continue;
                if (i % 5 == 0)
                    continue;
                if (i % 7 == 0)
                    continue;
                if (i % 11 == 0)
                    continue;
                Console.WriteLine(i);
            }
           
        }

    }
}

Answers (6)
Next Recommended Forum