i'm trying to output a number of "*" for the number it corresponds to in an array e.g
Code:
array[3]={1,2,3};
output:
1 |*
2 |**
3 |***
ii'm getting a weird output 'm not sure but i think the error is here
Code:
for(z_count=1; z_count<=nwords[y_count]; z_count++)
here's my code:
Code:
#include <stdio.h>
int main(void){
int nwords[10]={1,2,3,4,5,0,0,0,0,0};
int c, max, x, y_count, z_count;
c = max = x = y_count = z_count = 0;
for(x=1; x<=10; x++){
printf("%3d |",x);
// for(y_count=0; y_count<10; y_count++){
for(z_count=1; z_count<=nwords[y_count]; z_count++){
printf("*");
}
// }
printf("\n |");
printf("\n");
}
getch();
return 0;
}