- Joined
- Nov 24, 2004
- Messages
- 147
- Reaction score
- 2
Someone advice on my algorithm. I'm having a hard time trying to make a simple number sequence work
int a = 1;
int b = 2 ;
int c = 3;
int output = 0;
//(if a is smaller than b, b is smaller than c)
if a < b < c then
{
s = s + 1
}
else
{
(this will happens if a is 3, b is 2, c = 1
s = s - 1
}
for (int i=0; a<d; s)
{
output = c+ (c-b) * i
Console.WriteLine(output)
// if a,b,c is 1,2,3, display 4,5,6
// if a,b,c is 3,2,1, display 0 -1 -2
}
int a = 1;
int b = 2 ;
int c = 3;
int output = 0;
//(if a is smaller than b, b is smaller than c)
if a < b < c then
{
s = s + 1
}
else
{
(this will happens if a is 3, b is 2, c = 1
s = s - 1
}
for (int i=0; a<d; s)
{
output = c+ (c-b) * i
Console.WriteLine(output)
// if a,b,c is 1,2,3, display 4,5,6
// if a,b,c is 3,2,1, display 0 -1 -2
}
Last edited: