Originally Posted by Dave_Sinkula Code: #include <stdio.h> int main(void) { int i, j, mark[] = {7,6,9,4,7,7,5,10,8,6,5}; for ( i = 0; i < sizeof mark / sizeof *mark; ++i ) { printf("%2d|", i + 1); for ( j = 0; j < mark[i]; ++j ) { fputs(" ", stdout); } puts("*"); } puts(" +----------------------"); puts(" 0 1 2 3 4 5 6 7 8 9 10"); return 0; } /* my output 1| * 2| * 3| * 4| * 5| * 6| * 7| * 8| * 9| * 10| * 11| * +---------------------- 0 1 2 3 4 5 6 7 8 9 10 */ hi , How can I do this for the numbers that I'll enter randomly ??
#include <stdio.h> int main(void) { int i, j, mark[] = {7,6,9,4,7,7,5,10,8,6,5}; for ( i = 0; i < sizeof mark / sizeof *mark; ++i ) { printf("%2d|", i + 1); for ( j = 0; j < mark[i]; ++j ) { fputs(" ", stdout); } puts("*"); } puts(" +----------------------"); puts(" 0 1 2 3 4 5 6 7 8 9 10"); return 0; } /* my output 1| * 2| * 3| * 4| * 5| * 6| * 7| * 8| * 9| * 10| * 11| * +---------------------- 0 1 2 3 4 5 6 7 8 9 10 */
Let 2 year old topics die! Next time start a new topic and link to the old one.
This should be interesting ... But in the meantime here's a FAQ entry which might help: How do I... (Level 1) > How do I get a number from the user (C)
http://www.freechess.org