I am writing a program that will print the "*" based on the users input, the user will need to enter a number between 1 and 30 an the program will print the * n time. where n is between 1 and 30.
ex: user enters 7 output is "*******" for any n value between 1 and 30.
this is what i got so far:
int x;
char c = "*";
printf("%s","Please Enter a number between 1 and 30\n");
scanf("%d", &x);
if (x>=1)
{
printf("%d",x,c);;
}
looking for some guidance on the printf part, how do i get it to print the * by what x is, this is the lower limit as 1 is the lowest the user can enter 30 is the upper limit but usually i like to make sure the lower limit works first before the upper then its a simple copy paste and change the numbers. A separate if will be for any number out of bounds i.e anything less then 1 and greater then 30 will require the user to reenter, so far it just prints the number that was entering not the * that many times. Also if i have any other mistakes in my code feel free to correct me still learning.