Friday, 5 October 2012

Program Triangular


#include<stdio.h>
main()
{
int triangular,n,jumlah;
printf("Inputkan bilangan triangular : ");
scanf("%d",&triangular);
n=0; jumlah = 0;
while(n<=triangular)
{
jumlah += n;
n++;
}
printf("Jumlah bilangan triangular dari %d adalah %d\n",triangular,jumlah);
}

No comments:

Post a Comment

Related Posts

Related Posts Plugin for WordPress, Blogger...