int i, j ;
for (i = 1 ; i <= 3 ; i++) {
for (j = 1 ; j <= 5 ; j++) {
if ( 2 * i + j <= 7) {
printf("+") ;
} else {
printf("o") ;
}
}
printf("\n") ;
}
Click here for a sample answer.
#include <stdio.h>
#include "genlib.h"
#include "simpio.h"
int deep(int, int) ;
int space(int) ;
main() {
int a = 1, b = 2, c = 3 ;
a = deep(b + 5, c) ;
b = space(c) ;
printf("main: a = %d, b = %d, c= %d\n", a, b , c) ;
}
int deep (int x, int y) {
int z ;
z = x - y ;
printf("deep: x = %d, y = %d, z = %d\n", x, y, z) ;
return(z) ;
}
int space (int c) {
int a, b ;
a = 1 ;
b = c * 2 + a ;
a = b + 5 ;
c = deep(a, b) ;
printf("space: a = %d, b = %d, c = %d\n", a, b, c) ;
return(b) ;
}
Click here for a sample answer.
Click here for a sample answer.
+ + + +++++++ + + +User enters 5:
+
+
+
+
+
+++++++++++
+
+
+
+
+
Click here for a sample answer.