You are not logged in.
Pages: 1
hey guys ,
I was trying to figure out how to write the code to generate a list for the following code.... let me know if you guys can help?
the question was pick 5 number 1-56 ( No repeats) and an extra number 1-52
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int cnt = 0;
int x1,x2,x3,x4,x5,y;
for (x1=1;x1<57;x1++)
{
for (x2=x1+1;x2<57;x2++)
{
for (x3=x2+1;x3<57;x3++)
{
for (x4=x3+1;x4<57;x4++)
{
for (x5=x4+1;x5<57;x5++)
{
for (y=1;y<53;y++)
{
if (x1+x2+x3+x4+x5+y == 147)
{
cnt++;
}
}
}
}
}
}
}
printf("%d",cnt);
system("PAUSE");
return 0;
}
I mean instead of the list of 1,748,533 solutions on one single file, is it possible to put the soultions on multiple files?
Hi gAr and bobbym,
Sorry for such a late response.. After our last postings (post 22) I have been crammed with Finals, Papers, Projects and what not.... The project that you guys helped me on was a success , thanks again!...
.. I was wondering (just out of curiosity) since the file would be tremendously large to show all possible solutions, if there is an actual way to break up the solutions to accommodate the file size.
Thanks guys I appreciate it!
Hi bobym,
Whats your thought process behind the 42113?
Yes you got it!... Sorry for the confusion ... should have explained it better
Gar,
Yes order does not matter for the 5 number, but the magic number is at the end ....so technically order matters lol... let me know if this is confusing.......... the problem is like picking numbers for the lottery, for example: Mega Million, and the numbers you pick have to add up to 147
Gar,
Yes in the fact that you only pick one magic number but may not be distinct from the other five numbers.......
magic# magic#
random ex: 4 15 25 38 27 4 or 5 9 13 32 45 20
Hi gAr,
Yes sorry the 5 are distinct. No repeating numbers.
Hey everyone! I was wondering if someone can help me out. I have a math project and need a little help:
problem:
You are to pick five numbers ranging from 1 to 56 and a magic number ranging from 1 to 52. What you have to do is come up with possible combination that have a sum totaling 147. How many combinations are there? What are the combinations?
I was wondering if can help me start the problem ..... and is there a way to do this on excel or an online program I can use..
Pages: 1