Quote:
Originally Posted by amigo1
//
Code:
class Class1{
void Main()
{
int i = 1;
for (int a =0; a<11 ; a++)
Console.WriteLine(i++);
itr itrobj=new itr();
Console.WriteLine(itrobj.meth());
}
}
// Define other methods and classes here
class itr
{ int j = 1;
public int meth()
{
for(int b = 0 ; b<5 ; b++)
Console.WriteLine(j++);
return ??????;
}
}
I want to get this o/p
1
2
3
.
.
.
11
1
2
.
.
5
PLS Note that I would not like to tamper with the "b<5" part, that might b
e a requirement
any way out
.
|
Why do you return a value from the method meth? You do the WriteLine inside this method anyway.
From the Main method you can invoke it with itrobj.meth(); without passing it to Console.WriteLine.