-
Posts
26 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by LOGIC
-
-
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?
0 -
sorry I forgate to tell you about:-p
#include <stdlib.h>
0 -
What is the best way to end a program so it doesn't close until the user does something? My current method seems to cause crashage.
I think the best way is to put the following before return statement
system("PAUSE");
0 -
I wonder if there is only one programming language for all domains ,Should our lives, as programmers, been easier or difficult ?!
0 -
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?
0 -
Hi
I want to ask if there is a way to block users (cheldren) of windows XP from browsing the internet except one website?
0 -
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.
0 -
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> <? } ?>
0 -
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
but no correct answer !!
0 -
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!
0 -
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?
0 -
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
0 -
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 .
0 -
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 ?
0 -
Sorry I am late
WINDOWS XP
I read some lessons but what ever i do i get error
Microsoft Telnet> o http://www.dievo.org 82Connecting To http://www.dievo.org...Could not open connection to the host, on port 82:
Connect failed
what is wrong with this syntax ?!
I have putty.exe but I don't know how to use it
0 -
the problem with lvl 9 is I know no thing about telnet !!
what should I do?
is there any lesson or some thing ?
0 -
I am in apprentice level 9 now
I have calculus final exam tomorrow,I should stop playing
0 -
I passed it with dirty trick
0 -
I am stuck in level 4 there is flash box asked for password !!
0 -
It is a single formal language ,but each country has its dialect (Egyptian , goulf ,North Africa,...) which is the same as English.
0 -
you should register before
if you coluld submit the proof tell me.
0 -
I passed the hook but when I try to submit the proof I get this message
You entered an incorrect password, tried to complete a wargame that doesn't exist or you have either already completed the wargame or you have a submission for that wargame pending.can any one help!
0 -
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
0 -
any one interested in arabic can chat with me
0
sum of sequares
in Computer Science
Posted
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
thank you very much, your posts were very helpful