Jump to content

LOGIC

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by LOGIC

  1. 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. 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. sorry I forgate to tell you about:-p #include <stdlib.h>
  4. I think the best way is to put the following before return statement system("PAUSE");
  5. I wonder if there is only one programming language for all domains ,Should our lives, as programmers, been easier or difficult ?!
  6. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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 ?
  16. Sorry I am late WINDOWS XP I read some lessons but what ever i do i get error what is wrong with this syntax ?! I have putty.exe but I don't know how to use it
  17. the problem with lvl 9 is I know no thing about telnet !! what should I do? is there any lesson or some thing ?
  18. I am in apprentice level 9 now I have calculus final exam tomorrow,I should stop playing
  19. I passed it with dirty trick
  20. I am stuck in level 4 there is flash box asked for password !!
  21. It is a single formal language ,but each country has its dialect (Egyptian , goulf ,North Africa,...) which is the same as English.
  22. you should register before if you coluld submit the proof tell me.
  23. I passed the hook but when I try to submit the proof I get this message can any one help!
  24. hi I am Ahmed from Saudi Arabia , 21 years old. I am interested in any thing goes to computer. I study and live in KFUPM (King Fahd University of Petroleum and Minerals) in Dhahran I am in my third year studying computer science. not verry good in English although it is the language used in the university. you can find me in computer science section sea you there
  25. any one interested in arabic can chat with me
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.