4 _ 4 _ 4 _ 4 = 20
use +,-,/,* to solve it. write c++ code.
viv0411
0
Newbie Poster
Recommended Answers
Jump to Post#include <iostream> int main() { std::cout << (4 / 4 + 4 )* 4 ; return 0; }
Jump to PostAssuming the problem is slightly more general you have a list of number e.g.
int items[]={4,4,4,4};
and you have a target number T.
Now you need to clarify the rules:(i) are brackets acceptable: e.g. the given solution (4 / 4 + 4 )* 4 has to have brackets to get …
All 8 Replies
ganesh_IT
0
Light Poster
viv0411
0
Newbie Poster
iamthwee
Sky Diploma
571
Practically a Posting Shark
StuXYZ
731
Practically a Master Poster
iamthwee
commented:
Lisp? I'll look into this.
+12
iamthwee
StuXYZ
731
Practically a Master Poster
sundip
-3
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.