Friday, March 23, 2012

Print Values from 5 to 1



string strOp = string.Empty;
int j=5;
     for (int i = 1; i <= j; i++)
     {
         strOp += i.ToString() + "&nbsp;";
         if (i == j)
         {
            j = j - 1;
            i = 0;
            strOp += "<br/>";
         }
     }
    
 Response.Write(strOp);

Output  :

1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software