Tuesday 8 May 2012

UVa 10079 Pizza Cutting Solution

#include<stdio.h>
int main()
{
int a,i,n;
long int b,c;
while(scanf("%d",&n)==1 && (n>=0))
{
a=0;
b=1;
for(i=0;i<=n;i++)
    {c=a+b;
    a=a+1;
    b=c;}
printf("%ld\n",c);
}
return 0;
}

3 comments:

  1. please explain, how it works correctly

    ReplyDelete
  2. Haven't you replied it yet? It's been 1 year and I forgot what was my confusion about. Hope you reply soon! see ya next year :|

    ReplyDelete
  3. Just came back here to see if I got your reply yet. It's been 2 years! Are you on some "interstellar mission"? Hope to remember you back again after a year and be alive for that.

    ReplyDelete