Solution for SAMER08F problem in SPOJ.

problem link-  
http://www.spoj.com/problems/SAMER08F/

#include<stdio.h>
#include<math.h>
int main()
{
int n,i,sum=0;
while(1)
{
scanf("%d",&n);
if(n==0)
break;
for(i=1;i<=n;i++)
sum=sum+ pow(i, 2);
printf("%d\n",sum);
sum=0;
}
return 0;
}


this problem can be done without  using loop. 

Implemet Stack in python

  class Stack : def __init__ ( self , data ): self . stack = [] if ( data ): self . stack . append ( da...