Thanks Sandeep for quick respond.Actually i am new at the C# here is my full code:
static void Main(string[] args)
{
int n = 1;
while (n <= 75)
{
if (n % 5 == 0)
System.Console.WriteLine("Foo");
else if(n%7==0)
System.Console.WriteLine("Bar");
else if (n%5==0 && n % 7 == 0)
System.Console.WriteLine("FooBar");
else
System.Console.WriteLine(n);
n++;
}
It print correctly for number divisible by 5 and 7 but it print "Foo" for number is divisible my both 5 and 7.SO can you tell me what is wrong with code.As i am new to C# and is this is the fastest algorithm for this program.