Wednesday, January 22, 2014

UVa 913 - Joana and the Odd Numbers solution

Problem link :  UVa 913 - Joana and the Odd Numbers

Solution : 


#include<stdio.h>
int main()
{
    long long int a,n;
    while(scanf("%lld",&n)==1)
    {
        a=(((n*(n+2)/2)*3)-6);
        printf("%lld\n",a);
    }
    return 0;
}




No comments:

Post a Comment