Print expression as is without evaluating it
Posted
by Raj
on Stack Overflow
See other posts from Stack Overflow
or by Raj
Published on 2010-04-19T02:44:41Z
Indexed on
2010/04/19
2:53 UTC
Read the original article
Hit count: 303
i want to print the expression Xmin and Ymin as is without calculating the final value . i,e with the values of I and J as 1,2,3,4,5
example when I=1
Xmin= Xmin ((1 - 1)*10 + (1 - 1)*1)
is there a way to do it .. I tried the following code, but no luck:
int a, g;
a = 10;
g = 1;
for (int J=1; J<=5; J++)
{
for (int I = 1; I <= 5; I++)
{
string Xmin = Convert.ToString((I - 1)*a + (I - 1)*g);
string Ymin = Convert.ToString((J - 1) * a);
Debug.WriteLine("X=" + Xmin + "Y=" + Ymin);
}
}
© Stack Overflow or respective owner