# LOGIC

Members

26

## Community Reputation

10 Neutral

• Rank
Quark
• Birthday 12/27/1984

## Contact Methods

• Website URL
http://www.kfupm.edu.sa

## Profile Information

• Location
Dahran - Saudi Arabia
• College Major/Degree
King Fahd University of Petroleum and Minerals- Computer science
• Favorite Area of Science
programing languages
• Biography
anything goes computer
• Occupation
Student
1. ## sum of sequares

thank you very much guys. I forgot to mention that I am practicing writing algorithms by induction and that was one question the instructor gave us . After some tries I relied that the best way to write it recursively is to save the returned value and add the next returned to it by using a variable defined out side the function, but the problem was How could I make the first call for the function returns the value in that variable and make other calls return the square? I got some help from a friend and end up with this function int i,z,f; bool m=false; int sqr(int n) { int i,j=0; if(n>1) { if(!m) { z=n; m=true; } i=sqr(n-1)+n+n-1; f=f+i; if(n==z) return f; else return i; } else return f=1; } thank you very much, your posts were very helpful
2. ## sum of sequares

Hi I have tried to write program to calculate the sum of squares of number from 1 to n without using multiplication and it is supposed to be the efficient. I end up with this function that calculate the square of a number recursively and I made iterative function to calculate the sum of the squares but when it come to write the sum function recursively I could not do it. Take a look. c code for find the square int sqr(int n) { if(n>1) { return sqr(n-1)+n+n-1; } else return 1; } c code for the itritive sum square function int sumSqr(int n) { int i,j,f; for(i=1;i<=n;i++) { if(i==1) { j=1; f=j; } else { j=j+i+i-1; f=f+j; } } return f; } HOW TO WRITE SIMILER FUNCTION RECURSEVLY?
3. ## Learning C++. printf() is messy

sorry I forgate to tell you about:-p #include <stdlib.h>
4. ## Learning C++. printf() is messy

I think the best way is to put the following before return statement system("PAUSE");
5. ## If there is only one programming language

I wonder if there is only one programming language for all domains ,Should our lives, as programmers, been easier or difficult ?!
6. ## How to block all website ecsept one?

thank you for your replays and great ideas. In fact the idea was to block some employees in a shop of brows internet except the website which they need to register the bill in. Then the idea to use it in home as well has came. In such situation what is the best idea?
7. ## How to block all website ecsept one?

Hi I want to ask if there is a way to block users (cheldren) of windows XP from browsing the internet except one website?
8. ## Which Java IDE do you prefer?

It seems I am the only one using JCreator here. Our university installed in there labs which make all studens use it and I think it is easy to use.
9. ## PHP help

if there names like this "file1.txt,file2.txt,file3.txt...." and so on,you can use this simple code <? for($s=0;$s<100;$s++) { ?> <a href="/fictionall/file<?print$s; ?>.txt">File<?echo \$s; ?>.txt</a> <? } ?>
10. ## Hacking Challenges

Finaly I did it but I don't understand what did tou mean by "101 times in 4 days"!! any way I solved it thanx wait a sec in level 4 I tried all possible architecture could work in debian os http://www.debian.org/ports/ but no correct answer !!
11. ## Hacking Challenges

I am not sure if we are talking about the same level because there is no thing about indians. Aal what I have "What is the local ip of this server?" and text filed to write the ip in!
12. ## Hacking Challenges

try to find the difference brtween level three and the other level. it is not in the source. I am stuck in novice level2 I realize that i sould send to the server asking about its ip but I don't know HOW and telnet doesn't work !! is ther any helpful tool?
13. ## Hacking Challenges

I finished apprentice thank of Kygron I passed level 9 using GetRight. thank of BigMoosie I passed level 10 using firefox webdeveloper's toolbar thank you guys
14. ## Hacking Challenges

I read alot about http protocol and understand it very well. going through my school proxy is the problem. I will try it later when I go to home . thank you very much calbiterol .
15. ## Hacking Challenges

ok it seems it works with CRT 4.0 but I get connection time out after few seconds. After writing GET /apprentice/level5aaa/lvlll9.php HTTP/1.0 Referer: http://adminsAtWus.com what should I do ?
×