home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tybc4
/
dowhile2.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-22
|
468b
|
21 lines
// Program calculates a sum of squared odd integers in
// the range of 11 to 121
#include <iostream.h>
const int FIRST = 11;
const int LAST = 121;
main()
{
double sum = 0;
int i = FIRST;
do {
sum += double(i * i++);
} while (i <= LAST);
cout << "Sum of squared odd integers from "
<< FIRST << " to " << LAST << " = "
<< sum << "\n";
return 0;
}