I was meant to write a program so that it prints the number of stars. Example
Enter numbers : 12 11 9 8 ^D
12 | ************
11 | ***********
9 | *********
8 | ********
#include <stdio.h>
int main(int argc, char *argv[]) {
int a;
printf("enter values \n");
while (scanf("%d ", &a) != EOF) {
printf("%d |", a);
for (int j = 1; j<= a; j++) {
printf("*");
}
printf("\n");
}
}
With my code it prints out the right output but it doesn't print out the number of stars for the last value I enter. Like in the above example it wont print out 8 stars until I hit the enter again or press ^D. I was wondering is there somethign wrong with my code. ?