On lynx, use down arrow to move to the next question or choice. Hit return to make your selection.
On lynx, use down arrow to move to the next question or choice. Hit return to make your selection.
int i, j ;
for (i = 1 ; i <= 4 ; i++) {
for (j = 1 ; j <= 5 ; j++) {
if ( (i == 1) || (i == 4) ) {
printf("X") ;
} else if ( j == 5 ) {
printf("X") ;
} else {
printf("O") ;
}
}
printf("\n") ;
}
Sample Solution
1 + 3 + 5 = 9
If the user enters 9 as input, your program should print out:
1 + 3 + 5 + 7 + 9 + 11 + 13 + 15 + 17 = 81
Sample Solution
#include <stdio.h>
int lennie (int, int) ;
int squiggy (int) ;
main() {
int a, b, c ;
a = 1 ;
b = 4 ;
c = squiggy(3) ;
a = lennie(b, c) ;
printf("main: a = %d, b = %d, c = %d\n", a, b, c) ;
}
int lennie (int a, int b) {
int c ;
c = squiggy(a - b) ;
printf("lennie: a = %d, b = %d, c = %d\n", a, b, c) ;
return(c) ;
}
int squiggy (int a) {
int b, c ;
b = 3 * a - 1 ;
c = b - a ;
printf("squiggy: a = %d, b = %d, c = %d\n", a, b, c) ;
return(b) ;
}
Sample Solution
3
2 2
1 1 1
If the user enters 5 as the input, your program should print
out:
5
4 4
3 3 3
2 2 2 2
1 1 1 1 1
Sample Solution