I need to write a function that prints to the screen. If the input is 5, then the output is:
+**
****
*******
***********
****************
This is my current code:
int recursions(int number,int condition)
{
if(condition < 0)
{
printf("\n");
return 0;
}
else
{
printf("**");
recursions(number + 2,condition - 1);
}
}
int main()
{
int number;
printf("Please give a number!\n");
scanf("%d",&number);
printf("+");
recursions(number,number);
getch();
}
1 Answer