Question: Rewrite the C program below using Scheme. Your Scheme code should generate the same output. #include int func ( int a , int b )

Rewrite the C program below using Scheme. Your Scheme code should generate the same output.
#include
int func(int a, int b){
return (a * a + b);
}
int main(void){
int x[]={1,2,3,4};
int y[]={3,4,9,2};
int z[4];
for (int ii=0;ii<4;ii++){
z[ii]= func(x[ii],y[ii]);
}
for (int ii=0;ii<4;ii++){
printf("%d ", z[ii]);
}
return 0;
}
Rewrite the Scheme program below using C. Your C code should generate the same output.
(define a 10)
(define b 5)
(define c (+ a b))
(define func
(lambda (c)
(if (= c 0)
'()
(cons c (func (- c 1))))))
(func a)
(func c)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!