In the following C program, replace(not add or delete) only one character so that it would print 20 dashes.
int i, n = 20;
for (i = 0 ; i < n ; i--) {
printf("-");
}
Find three different solutions to this puzzle.
1.
int i, n = 20;
for (i = 0 ; i < n ; n--) {
printf("-");
}
2.
int i, n = 20;
for (i = 0 ; i + n ; i--) {
printf("-");
}
3.
int i, n = 20;
for (i = 0 ; -i < n ; i--) {
printf("-");
}
Winner: None
No comments:
Post a Comment