There are no intentional syntax errors in this section. Answers like ``There is no output, because there is a syntax error'' will receive 0 credit.
int i, j ;
for (i = 0 ; i < 5 ; i++) {
for (j = 0 ; j < 5 ; j++) {
if ( i * i >= j) {
printf("X") ;
} else {
printf("O") ;
}
}
printf("\n") ;
}
Click here for a sample solution.
#include <stdio.h>
#include "genlib.h"
#include "simpio.h"
int foobar(int a) ;
int geez(int b) ;
main() {
int a = 1, b = 2, c = 3 ;
c = geez(a) ;
b = foobar(c) ;
printf("main: a = %d, b = %d, c= %d\n", a, b , c) ;
}
int foobar (int b) {
int a, c ;
a = geez(b) ;
c = b++ ;
printf("foobar: a = %d, b = %d, c = %d\n", a, b, c) ;
return(c) ;
}
int geez (int c) {
int a, b ;
a = c + 100 ;
b = 2 * a ;
printf("geez: a = %d, b = %d, c = %d\n", a, b, c) ;
return(a) ;
}
Click here for a sample solution.
1 9 25 49 81 121 169
Click here for a sample solution.
Click here for a sample solution.