By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,142 Members | 822 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,142 IT Pros & Developers. It's quick & easy.

I have code how to print identity matrix but i want it to multiply by character L

P: 12
Expand|Select|Wrap|Line Numbers
  1. identity = new int[SS, SS];
  2.             for (int row = 0; row < SS; row++)
  3.             {
  4.                 for (int col = 0; col < SS; col++)
  5.                 {
  6.                     identity[row, col] = (row == col) ? 1 : 0;
  7.                     Response.Write(identity[row, col] + " ");
  8.                 }
  9.                 Response.Write("<br/>");
  10.             }
  11.  
the above code displays output suppose consider 3 x 3 matrix
it prints identity matrix as
1 0 0
0 1 0
0 0 1

i want to multiply it by L character so that the output must be
L 0 0
0 L 0
0 0 L

i have tried no.of ways but it is printing ASCII number of alphabet please help........
Jun 1 '10 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 218
Just mutiply the matrix' value by L.
L is int, 76 would be the ASCII number for 'L'
Or use Convert.ToInt32('L')

And when printing, convert value back to char by using Convert.ToChar(intValue);
Jun 2 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.