Hi there....

I have a problem with one of my programs ...and here is the question
" The program is to input five numbers between 1 and 30 such that it gives the output of each number as the corresponding number of asterisks"

the problem is that when I run the program it make me enter the number 2 times then to show the corresponding asterisks......so please any one answer me

Thank You

2. Post the code

The Code.txt

4. hey......did you find it ?????

5. Code:
```#include <stdio.h>

int main()
{
int counter =1;
int x;

printf( " Enter numbers between 1 to 30 \n " );

while( counter <= 5 ){

printf( "\nEnter the number\n " );
scanf( " %d " ,&x );

while( x <= 30 ){

x = x - 1;
printf( "*" );

if( x == 0 )
{
break;
}

}

counter = counter + 1;

}

printf( " \nThe End\n\n " );

return 0;

}```

6. first, can you write a code to print the amount of * equal to a number the user inputs?

7. Code:
`scanf( " %d " ,&x );`
Check it..

8. I already did it in the code shown......

in the loop >>>>>> while( x <= 30 )....it will do successive subtraction from the number the put * to each 1 subtracted until the number is zero it came out of this loop and increase the counter and so on.....

9. @ rob90

what do you mean by checking it .....

I know that something must be done before something but I don't get it !!!!!

10. Since you still dont get it I'll tell you, you put an extra space in the scanf() function, change it with
Code:
`scanf("%d", &x);`
Moreover you can simplify you program by doing something like:
Code:
```scanf("%d", &x);
for(j=0;j<x;j++) putchar('*');
.... // continue the loop```
You dont need to make any subtraction

11. IT REALLY WORKS

really thank you for your help...."Grazie mille"...

Thanks

12. This is the problem:
Code:
`scanf( " %d " ,&x );`
Take the spaces out of the quotes.