## Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only

cyclic sum Posted by pixie123 on 30 Jan 2012 at 1:31 AM
hello everyone! i wanted to know if enyone can help me with this: i am learning pascal basics in school so i have one little problem with this:

i want to make programm where the 'x' value type user, and then the sum is calculated, but i dont know how to make formula for this

(1/2)+(3/2^2)+(5/2^3)+...+((2x-1)/2^x)

so the formula is ((2x-1)/2^x); for example: user types that x is 3;
then the programm puts 3 in x place; then 2; and then 1 and then all this sum together like this example where x is 3
((6-1)/8) + ((4-1)/4) + ((2-1)/2) = ...

so i want to create summing like this, i think it is something related with cycles, but i dont know for sure, so if anyone can help me i'll be grateful :)

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.