• + 1 comment

    Try to change

    for(int i=1;i<=N;i++){
    

    to

    for(int i=0;i<=N;i++){