Search........

Google

Friday, March 7, 2008

While Loop

//Now let us see how the while loop works
using System;

namespace whileloop

{

class cl1

{

static void Main()

{

int i=0,j,sum=0;

Console.WriteLine("Enter 10 No.s");

while(i<10)

{

j=Convert.ToInt32(Console.ReadLine());

sum=sum+j;

i++;

}

Console.WriteLine("Sum="+sum);

}

}

}

No comments: