My Weblog

Blog about programming and math

Solving problems in C/C++ Vs Pyhton

I used to solve problems of project euler( This site has quite interesting and challenging problems of number theory. If you want to solve any problem you must have knowledge of atleast one programming language  and  bit of math is also required[:)].My programming language is C and i admire this language but this site does not pose any constraint for programming language because you have to submit your answer rather than code.Now a days i started learning Python and i solved cople of problems in Python.The major difference which i noticed if you are trying to solve the problem in C/C++ , you have to consider overflow otherwise your program will not behave as you want:(  and you have to come up with some sophisticated techniques and algorithm to reach the answer.But if you are using some scripting language like perl , python ,Tcl or Ruby you even need not to bother until unless problem is challenging.Depending on algorithm used execution of C/C++ programs will be enough  less than Python or other scripting language.What is personally fill that if you want to become a good programmer you must learn first C/C++ but its totally my personal opinion.Here is python code for problem 119


def fun(n,k):
for i in range(k):
while w:
return sum;
return 0;

for i in range(2,100):
for j in range(1,100):
if ((v==i)) :
#print i,’ ‘,j,’ ‘,i**j;

print l[29];


March 2, 2008 - Posted by | Uncategorized

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: