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

23rd Jun 2017, 3:02 PM
Sakshi Gupta
Sakshi Gupta - avatar
4 Answers
+ 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
23rd Jun 2017, 3:08 PM
M Rizky Widyayulianto
0
in c++
23rd Jun 2017, 3:09 PM
Sakshi Gupta
Sakshi Gupta - avatar
0
thanks
23rd Jun 2017, 3:15 PM
Sakshi Gupta
Sakshi Gupta - avatar
- 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; }
23rd Jun 2017, 3:14 PM
M Rizky Widyayulianto