C# For Loop Statement - How do i pass variable at counter part in for loop statement

  • Thread starter Thread starter Gani tpt
  • Start date Start date
G

Gani tpt

Guest
I want to pass variable at counter in for loop statement.

for example, i have the below for loop statement in C#.

int start = 5;

int end = 10;

int count = 0;

if (start > end)

{

count = count+1;

}

else if (start < end)

{

count = count-1;

}

for (int i = start; i >= end; i--) ==> i want to make it as "i--" as variable. and i want pass count++ or count-- as variable.

{

}

final output should be

for (int i = start; i >= end; "count++ or count--") ==> I just want to pass count++ or count-- as variable instaed of i++.

{

}
pls. guide us if any alternate way to do this..

Continue reading...
 
Back
Top