Question

a) Make a function which returns x/3 with a given integer x. double third(int x) {...

a) Make a function which returns x/3 with a given integer x.

double third(int x) {

//Complete your code below.

______________________________________

return y;

}

b) Make a program which shows 2 ∗ n with a given user input n.

#include<iostream>

using namespace std;

// Complete the blank.

_______________________

int main(){

int n;

cout<<"Enter:";

cin>>n;

cout<<twice(n);

return 0;

}

int twice(int x){

return 2*x;

}

c) Make a function which returns true if n is positive, otherwise returns false.

________ positive(int n){

if( ) return true;

else return false;

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1
a)
double third(int x) {
    double y = x/3.0;
    return y;
}

===================================

b)
#include<iostream>
using namespace std;

int twice(int);
int main(){
    int n;
    cout<<"Enter:";
    cin>>n;
    cout<<twice(n);
    return 0;
}

int twice(int x){
    return 2*x;
}

===================================

c)
bool positive(int n){
if(n>0) 
    return true;
else
    return false;
}

Please upvote the solution if it helped. Thanks!

Add a comment
Know the answer?
Add Answer to:
a) Make a function which returns x/3 with a given integer x. double third(int x) {...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT