Friday, June 24, 2011

The number of odd

The number of odd

# include <iostream>
# include <conio.h>

int i, n, total;
void input ()
{

court <<"Enter the odd / even =";
cin>> n;
court <<endl;
}
void process ()
{
for (i = 1; i <n; i = i +2)
{
court <<"" <<i <<"";
total = total + i;
}
court <<"\ n The sum of all of the odd numbers less than" <<n <<"is" <<total <<"";
}
main ()
{
input ();
process ();

getch ();
}.........

0 comments:

Post a Comment