Hello to all
Below is my simple code. The problem is they are again and again showing that sum and i does not exist in the current context. I am not getting my problem how to correct the code.I am new learner of c# so please explain it also.
namespace table2
{
class Program
{
static public void Main()
{
int num; i = 0; sum = 0;
do
{
Console.WriteLine("Enter Number");
num = Convert.ToInt32(Console.ReadLine());
if (num < 0)
{
continue;
}
sum = sum + num;
i++;
}
while (i < 3);
Console.WriteLine("Sum of positive nos ={0}",sum);
Console.ReadLine();
}
}
}
Regards
Payal