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

Download excellent quality study note and ebooks of amie section a on Computing and Informatics (AD 303) in pdf,ppt,doc format
Post Reply
RAVIGARU
Adviser
Adviser
Posts: 313
Joined: Sat May 05, 2012 9:47 pm
Contact:

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

Post by RAVIGARU »

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 ();
}
You do not have the required permissions to view the files attached to this post.

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

Sponsor

Sponsor
 

Post Reply

Return to “Computing and Informatics (AD 303)”