O
Odinn
Greetings , This is my first year at programming and 3rd week at this
so count me as a pure newbie.
I am trying to make a program that gets a number and prints out starts
as this:
For input 3 :
*
**
***
For input 6:
*
**
***
****
*****
******
As you see the program I am trying to make generates as much as lines
as the input number , one star increasement at each line.
This is the program I wrote:
#include <stdio.h>
star(int x)
{
int i=1;
while(i<=x)
{
printf("*");
i++;
}
}
print(int x){
int start = 1;
int end = x;
while (start <= end)
{
printf("%d \n", star(start) );
start++;
}
}
main()
{
printf("Enter value \n");
int veri;
scanf("%d", &veri);
print(veri);
}
Seems works but with a bug:
I always get a number after stars such as this:
Ex:
Enter value
8
*2
**3
***4
****5
*****6
******7
*******8
********9
Thanks in advance
so count me as a pure newbie.
I am trying to make a program that gets a number and prints out starts
as this:
For input 3 :
*
**
***
For input 6:
*
**
***
****
*****
******
As you see the program I am trying to make generates as much as lines
as the input number , one star increasement at each line.
This is the program I wrote:
#include <stdio.h>
star(int x)
{
int i=1;
while(i<=x)
{
printf("*");
i++;
}
}
print(int x){
int start = 1;
int end = x;
while (start <= end)
{
printf("%d \n", star(start) );
start++;
}
}
main()
{
printf("Enter value \n");
int veri;
scanf("%d", &veri);
print(veri);
}
Seems works but with a bug:
I always get a number after stars such as this:
Ex:
Enter value
8
*2
**3
***4
****5
*****6
******7
*******8
********9
Thanks in advance