|
|
back to boardWhy Crash(access violation)?? Posted by park 9 Oct 2006 22:17 This is my code : #include<stdio.h> void main() { int n,k,i; long a[8]; scanf("%d",&n); scanf("%d",&k); for(i=0;i<n;i++) { if(i==0) { a[i]=k-1; } else if(i==1) { a[i]=(k-1)*k; } else { a[i]=(a[i-1]+a[i-2])*(k-1); } } printf("%ld",a[n-1]); } Edited by author 09.10.2006 22:18 |
|
|