![]() |
| | #1 |
| Registered User Join Date: Sep 2008
Posts: 37
| Program that uses the while loop to compute and print the sum of a given number of squares. Ex. If 5 is Input program will print 55 I'm not asking to do this for me just want Ideas. I'm kind of slow at the beginning of evrything but at the end I'll never forget it. |
| Cyberman86 is offline | |
| | #2 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| The idea is given to you: "use the while loop to compute and print the sum of a given number of squares". So -- figure out the conditions on the while loop (i.e., when should it stop) and what computation needs to happen each step through. |
| tabstop is offline | |
| | #3 |
| Banned Join Date: Aug 2001 Location: Visalia, CA, USA
Posts: 3,699
| if x = something n := 0 for each x n := n + x * x x := x - 1 loop Right? I mean I know its sort of pseudo-code and sort of a hybrid between basic and pascal, but you get the picture. The trick is getting the input and having a second variable maintain the summation. |
| master5001 is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C keep a loop going whilst program continues on | fortune2k | C Programming | 6 | 03-11-2009 08:44 AM |
| Dynamic Link to DLL with LoadLibrary corrupts control loop | Ramses800 | C Programming | 8 | 12-01-2008 10:09 AM |
| Issue with program that's calling a function and has a loop | tigerfansince84 | C++ Programming | 9 | 11-12-2008 01:38 PM |
| Need help with a loop program | hieugene | C++ Programming | 12 | 10-11-2006 02:42 AM |
| Read a file into a loop program | TimeClock | C Programming | 5 | 07-17-2003 06:29 PM |