Problem Type :Super Easy
#include <stdio.h>
main()
{
long int a,answer;
while((scanf("%ld",&a))==1)
{
if(a<0)
break ;
answer=(a*(a+1)+2)/2;
printf("%ld\n",answer);
}
return 0;
}
#include <stdio.h>
main()
{
long int a,answer;
while((scanf("%ld",&a))==1)
{
if(a<0)
break ;
answer=(a*(a+1)+2)/2;
printf("%ld\n",answer);
}
return 0;
}
No comments:
Post a Comment