0
Make a program in which If the no. Is even then divide by 3 and when the no is odd then multiply by 7
4 Respuestas
+ 2
on what language?
well the steps are:
first you input the variable (x), then use the mod function,
if x mod 2 = 0 then divide x with 3
else multiply x with 7
then you return the result
edit: misread the question
0
in c++
0
thanks
- 1
#include <iostream>
using namespace std;
int main() {
int x;
cin >>x;
if (x%2 == 0) {
x = x / 3;
} else {
x = x * 7;
}
cout << x;
}