Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Create array as given below, and fill the series value with for , next loop.
1   2   3   4   5
1   4   9   16  25
1   3   5   7   9
9   7   5   3   1


any one will help me..
Posted
Updated 30-Nov-11 23:29pm
v2
Comments
R. Giskard Reventlov 1-Dec-11 5:28am    
Is this homework? Looks like it: we don't do homework.
ythisbug 1-Dec-11 5:35am    
hey no buddy..just am trying to print tat using for loop in asp.

You can using the multidimensional array.

Go through this one

http://msdn.microsoft.com/en-us/library/2yd9wwz4(v=vs.71).aspx[^]
 
Share this answer
 
You can't use a for loop to fill the series - not without an external data source of some kind. To do it with just a for loop and no external data source would be very, very clumsy, as you would need loads of "is this row one?" and "if so, is this column 2?" "If so, use the value 2" satatememts.
Do it the easy way:
C#
int[][] data = new int[][] {new int[] { 1, 2,  3,   4,   5},
                            new int[] { 1,   4,   9,   16 , 25},
                            new int[] { 1,   3,   5 ,  7 ,  9},
                            new int[] { 9,   7,   5  , 3,   1}};
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900