1. 程式人生 > >N條直線所劃分的平面個數

N條直線所劃分的平面個數

#include <stdio.h>
#include <stdlib.h>
int lines(int n)
{
if(n==1)
return 2;
else
return n+lines(n-1);
}
int main()
{
int n,m;
printf(“Please enter the number of lines\n”);
scanf("%d",&n);
m=lines(n);
printf(“the number of planes is %d\n”,m);
return 0;
}