219k views
5 votes
Which of the following code segments does not contain any errors?

Select one:
a. void printnum (int x) { print("%i", x); return x; }
b. int cube(int s) { int s; return (s s s); }
c. double triple(float n) { return (3 * n); }
d. double circumference (int r) return (3.14 2 r);

User Wforl
by
5.8k points

1 Answer

2 votes

Answer:

c. double triple(float n) { return (3 * n); }

Step-by-step explanation:

In option a print is used to print integer.While printf is used in C to print something.

In option b there is no * operator between s s s it should be s*s*s.So it will give error.

In option d there is also no multiply operator * in between 3.14 2 r it should be 3.14*2*r.

So we can say that option c is error free.

User ISensical
by
5.5k points