What about
double foo(int start, int end)
{
if ( end < start )
return 0;
return start + foo(start + 1, end);
}
Type: Posts; User: cyph1e
What about
double foo(int start, int end)
{
if ( end < start )
return 0;
return start + foo(start + 1, end);
}
If you want to be able to calculate "n choose k" for n or k > 13, using integer arithmatics, you could let P_num be a list of the prime factors of n!, and P_den be a list of the prime factors of...
You do realize that (X^(n/2))^2 = X^n and (X * ((X^(n/2))^2)) = X^(n+1)? No need to overcomplicate things. However, if n is an integer, both will be X^n. Are you sure that is not the case? It seems...
Doriän, I've spent some time on project euler aswell some time ago. For this problem you don't need to handle 50-digit numbers, in fact, the native types will suffice (if you read the description...
How else would you convert it?
Here's an article about it: http://www.osix.net/modules/article/?id=792.
*((long int *)58112) perhaps?
Why not simply:
char * look(char *str, char ch)
{
while(*str != ch && *str)
str++;
return str;
}
for( double t = 0.0 ; t <= pi/2; t += 0.03)
It's allright now dear. You've made your point. Since the last posts here have just been you guys arguing I assume theres no way to do what I wanted in the first place.
Ah I see. I thought it was translated like a normal if-statement at compile time. But that explains it. Thanks
Hi!
Is there any way to use 'break', 'continue', and 'return' statements in an if-statement of the form "expr ? t : f"? My compiler complains when I try this.
It's simply because the key and message doesn't have the same length. Use this:
message[i] = message[i]^key[i%strlen(key)];
One example where a do{ ... }while(); loop was useful for me was when I needed to create a random string which wasn't already present in a database.
So,
do {
//generate string
//query...