Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

Is there a mathematical way to do what this C program does

See more answers at
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly


Get your free account and access expert answers to this and thousands of other questions

#define close_enough 0.01 main() { char facts[] = {"fat (grams)", "calcium (%)", "carbs (grams)", "vitamin D (%)", "cholesterol (%)" }; double ingred[3][5] = { { 0, 1, 2, 4, 3 }, { 3, 4, 5, 0, 3 }, { 0, 6, 0, 7, 8 } }; int numbers_should_equal_this[] = { 15, 43, 4, 7 ,3}; int looper[3]; for (looper[0] = 0 ; looper[0] < 100 ; looper[0]++) for (looper[1] = 0; looper[1] < 100 - looper[0]; looper[1]++) for (looper[2] = 0; looper[2] < 100 - (looper[0] + looper[1]) ; looper[2]++) if (ingred[0][0] * (looper[0] / 100.0) < close_enough) if (inged[1][0] * (looper[1] / 100.0) < close_enough) if (sugar[2][0] * (looper[1] / 100.0) < close_enough)
:) it is not complete, but you get the idea
What is it meant to do?

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

You do have a mathematical way to do this - it's your algorithm.
this is not complete but complicated
I'm closing my eyes. I had a test yesterday in Object Oriented Programming ._.
it will figure out what ratios of ingredients are needed for a given food. For example I have a cheesecake snack which contains only cream cheese, sour cream, sugar and eggs. I know from the box the nutritional facts of the box, and I know the nutritional facts about each ingredient. Now with this information I should be able to figure out the ratios with a program that just tries every possibility and checks to see if the numbers work.
OOP is cool but this is not OPP
is this linear programming?
you guys should see my 24000 lines C++ code LOL
programming scares me
I guess it is procedural programming, not linear, IMHO
programming is easier than most ppl think
lol angoo, I do practice programming, but I don't go deep into it.
my programs never work properly and i have no patience and just get angry
what language do you use loki
LOL , let me guess, error error unable to complie LOL
some random crap
which language do you use? Java, C++? C? C# etc etc
i used C program with bloodshed dev c++
you can learn enough of programming to make a simple text based role playing game in about a month
I don't know. I was forced to do some as part of my degree. C or something.
I use Java , since it's the only language available to practice here in campus
YEY!!! I also used to use Bloodshed
Yeah, you're all nerds...
lol =D
I ain't a nerd, you should see me in real life LOL, you would be surprised
I know you are kidding, so am I
there's a difference between a nerd and a geek, geek = computer more person, nerd = study more person lol
to make a mathematical program from complicated case, u have to learn linear programming, i think.
no need
so you're saying if i saw you, i *would* think you were a nerd?
I was so proud of the program I wrote lol, finding the factorial of a number >_<
it took me AGES ._.
no, you would not, not a chance, everyone is surprised when I tell them I am into computers and geek stuff
they think I am a bodybuilder or something
kidding, no, in real life you it is quite easy to see I am into TECH
in the end noone can solve ur algorithm lol
lol, in other words , a geek with a pretty smile =D I guess?
I am just trying to confuse you all
not working here ^_^
Yeah, I'm confused.
then angoo striked one person, he's what do you call that thing, um, socializing thingy?
so guys, anyone wants C++ lessons? *eating a bannana*
BMF u made a HERO confused, well done
he has done it before lol
loki is drunk ~
bananas get you excited LOL
I never want to see C++ or any C again
I have never even seen C++ or C
i want to see A always
If I can't do it with pen and paper or on excel, i get someone to write up a program
C++ is very simmilar to java
try try try again and again
that's what I've heard andy
but they say C++ is alot more easier than Java
my problem is that it's so finicky. so much room for error. one mistake and you can spend hours looking for it.
and, no, bananas do NOT get me excited, they are just fruit
lol, they get you excited :)
nah, java and C++ are exactly of same difficulty
ahh outta topic
they have a very long-named chemical that I don't remember that gives you energy ^_^ same thing with chocolate and barely. I forgot the name hmm wait
just that, java is used for one thing, and C++ in other situations
Oh yeah, Tryptophan! :) that's what it's called
Tryptophan puts you to sleep!
banana , choco, and barely = goog for heart = because they contain serotonin.
it's in turkey
lol, it's in bananas, chocolate and barely lol
I have attended an Organic Chemistry course for fun ^_^
Java: -Finances -Web -Simple boring games C++ -Operating Systems -Almost all comercial software -Bank server software -Airplane software -3D games (like for PS3, PC...)
but they're using java now
folks, all of u get a job, someone asking about max domain
I'm not sure of the maximal domain >_<
nope, not everyone, java is great for smal programs, C++ is good for complex comercial ones, the multimilion ones
They've stopped teaching C++ though
do you know why? because with java it is easyer to make simple programs and dysplay simple graphics, which is good for learning, but C++ can take very long time to learn, just to draw a cube on the screen is hard
They say that in computer engineering, C++ will be taught and Java will be ignored.
anyways, languages are languages, all function the same in the end.
all have one place to go, all have same use.
stupid computer with some human intelligence
obedient to the rules.
check this, it has a simple C++ program with two 3D objects spinning aroun, AND a cpp file with the SOURCE CODe
1 Attachment
so finaly you can see how C++ looks and how much code you need to do that simple stuff
I'll check it later , thanks
I guess
oh, and check this, it is more fun# =D
will do
make sure to examine the code =D LOL
the cpp file
not in my current mood lol, but I will later.
thank you.
If you want a mathematical way, you should consider functional programming. e.g. Haskell
lol, finally someone has answered the question that was displayed
ok, I will check out haskell, shouldn't be hard after learning C++
if you're good at the previous ones, then the new ones will be easily absorbed by you ^_^
Well, it is, after all, a different programming paradigm. You not only have to learn new names and a little syntax, but you also have to think differently about your algorithms — in a more mathematical way.
yeah, algorithms algorithms
I'm off to go soon, later :)

Not the answer you are looking for?

Search for more explanations.

Ask your own question