Answer to Question #278814 in Python for Varaprasad

Question #278814

write a program to print the triple of number N if it is a multiple of 3 otherwise, double of N


1
Expert's answer
2021-12-12T20:21:30-0500
#include <iostream>


using namespace std;


int main()
{
    int n;
    cin >> n;
    if (n % 3 == 0)
    {
        cout << n * 3;
    }
    else
    {
        cout << n * 2;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS