Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 03-15-2009, 08:04 PM   #1 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default programming problems for you solve

Project Euler

Quote:
What is Project Euler?
Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.



Who are the problems aimed at?
The intended audience include students for whom the basic curriculum is not feeding their hunger to learn, adults whose background was not primarily mathematics but had an interest in things mathematical, and professionals who want to keep their problem solving and mathematics on the edge.



Can anyone solve the problems?
The problems range in difficulty and for many the experience is inductive chain learning. That is, by solving one problem it will expose you to a new concept that allows you to undertake a previously inaccessible problem. So the determined participant will slowly but surely work his/her way through every problem.

office politics is offline  
Old 07-08-2009, 03:27 PM   #2 (permalink)
swibit's Avatar
 
True Techie

Join Date: Jun 2009

Location: Europe

Posts: 103

swibit is on a distinguished road

Default Re: programming problems for you solve

Have you managed to solve any yet?
I'm just getting into the language, just needing a couple more resources and I should in a couple of months, be able to attempt these.
swibit is offline  
Old 07-09-2009, 02:48 AM   #3 (permalink)
S0ULphIRE's Avatar
 
01001100011011110110110

Join Date: Mar 2007

Location: Perth, Australia

Posts: 1,940

S0ULphIRE has a spectacular aura aboutS0ULphIRE has a spectacular aura about

Send a message via MSN to S0ULphIRE
Default Re: programming problems for you solve

Hmmm, how interesting! Let's see if we can get some compact code for problem 1.
Code:
void main (void)
{ 
  uns16 var,answer;
  while(var!=999)
          {
          var=var+3;
          answer=answer+var;
          }
  var=0;
  while(var!=1000)
         {
         var=var+5;
         answer=answer+var;
         }
}

__________________
"As a result of all this hardship, dirt, thirst, and wombats, you would expect Australians to be a dour lot. Instead, they are genial, jolly, cheerful, and always willing to share a kind word with a stranger, unless they are an American."
-- Douglas Adams

Click this if I helped you
>>>><<<<
S0ULphIRE is offline  
Old 07-09-2009, 06:12 PM   #4 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: programming problems for you solve

Code:
int MAX = 10;
int calc(int q);

int main(void)
{
	int q1 = 3;
	int q2 = 5;
	
	printf("%d + %d = %d\n", calc(q1), calc(q2), calc(q1) + calc(q2));
	return EXIT_SUCCESS;
}

int calc(int q)
{
	int points = (MAX - 1) / q;	//points on the graph
	int yDiff = (points * q) - q;	//height of the slope
	int area = (yDiff * points) / 2;	//area under the graph
	
	return area + (points * q);	//return the area plus the graph offset
}
EDIT: just change MAX to 1000, I was testing it against 10 because that gave a known answer.
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page

Last edited by kmote; 07-09-2009 at 06:16 PM.
kmote is online now  
Old 07-09-2009, 07:51 PM   #5 (permalink)
S0ULphIRE's Avatar
 
01001100011011110110110

Join Date: Mar 2007

Location: Perth, Australia

Posts: 1,940

S0ULphIRE has a spectacular aura aboutS0ULphIRE has a spectacular aura about

Send a message via MSN to S0ULphIRE
Default Re: programming problems for you solve

^so what answer do you get? I haven't tested my code yet, as I'm on a Mac and I don't have a compiler...
edit: and lol, that's a pretty complicated way of doing it don'tcha think?
__________________
"As a result of all this hardship, dirt, thirst, and wombats, you would expect Australians to be a dour lot. Instead, they are genial, jolly, cheerful, and always willing to share a kind word with a stranger, unless they are an American."
-- Douglas Adams

Click this if I helped you
>>>><<<<
S0ULphIRE is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
The Falcon Programming Language: a brief tutorial Saxon Programming Discussions 2 02-27-2009 03:43 AM
Many Problems With Comp Doorknob Windows Operating Systems and Software 6 02-15-2009 08:54 PM
Please Help Me To Solve This Problem... rest_24 Hardware Troubleshooting 7 01-14-2009 05:37 AM