0

Can anyone spot the semantic error in this triangular number calculator here? It correctly reports 21 as being a triangle number but incorrectly that 15 is not a triangle number. However if you input 15 as the first value entered it correctly says that 15 is a triangle number!!

```
int main(int argc, char* argv[])
{
int Number;
int Index;
char Again;
Index = 1;
Again = 'y';
while (Again == 'y')
{
Number = ReadIntPr("Enter number for testing: ");
while (Index*(Index+1) < 2*Number)
{
Index = Index + 1; //'i' was used rather than index here
}
if (Index*(Index+1) == 2*Number) //the correct 'is equal to' was not used
WriteStringCr("Triangular");
else
WriteStringCr("Not triangular"); //the semicolon here was not included
Again = ReadCharPr("Test another number (y/n)? ");
}
getchar();
return 0;
}
```