Tough C Programme of Winter 2007, Section A (D)

Problem is Attached and output screen shot is attached
programme:
----------------------------------------------------------------------------------------------
#include <stdio.h>
int main (void)
{
int triangular, loopcount, total;
loopcount = 0;
total = 0;
printf ("Enter number: ");
scanf ("%d", &triangular);
printf("IN ADDITION TO THE OUTPUT AS REQUIRED IN THE PROBLEM IT DISPLAYS\n");
printf("THE ALL POSSIBLE TRIANGULAR NUMBERS BETWEEN 0 AND N\n");
while (total < triangular)
{
/*IN ADDITION TO THE OUTPUT AS REQUIRED IN THE PROBLEM IT
DISPLAYS THE ALL POSSIBLE NUMBERS BETWEEN 0 AND N*/
printf("Possible triangular numbers: %d\n", total);
loopcount = loopcount+1;
total = total + loopcount;
}
if (triangular == total)
printf ("The give number %d is trinagular: %d\n", triangular, triangular == total);
else
printf ("The given number %d is non-trinagular: %d", triangular, triangular == total);
getch ();
}
programme:
----------------------------------------------------------------------------------------------
#include <stdio.h>
int main (void)
{
int triangular, loopcount, total;
loopcount = 0;
total = 0;
printf ("Enter number: ");
scanf ("%d", &triangular);
printf("IN ADDITION TO THE OUTPUT AS REQUIRED IN THE PROBLEM IT DISPLAYS\n");
printf("THE ALL POSSIBLE TRIANGULAR NUMBERS BETWEEN 0 AND N\n");
while (total < triangular)
{
/*IN ADDITION TO THE OUTPUT AS REQUIRED IN THE PROBLEM IT
DISPLAYS THE ALL POSSIBLE NUMBERS BETWEEN 0 AND N*/
printf("Possible triangular numbers: %d\n", total);
loopcount = loopcount+1;
total = total + loopcount;
}
if (triangular == total)
printf ("The give number %d is trinagular: %d\n", triangular, triangular == total);
else
printf ("The given number %d is non-trinagular: %d", triangular, triangular == total);
getch ();
}