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;
}

猜你喜欢

转载自blog.csdn.net/qq_43694257/article/details/85606245