Sunday, July 25, 2010

Real Gay Father Son Incest

Print odd and even numbers from 1 to 'n'

This is a simple example of the combined use of cycles ( For in this case) and conditionals.
The first idea is to print all the odd numbers from 1 to n, then the couple, noting that "n" is a predefined value, although it could be a simple modification for the user to enter the number.
we go.

 
\u0026lt;iostream> # include using namespace

std;

int a, b, c, d;

int main (void) {

court \u0026lt;\u0026lt;"Printing of odd numbers from 1 to 999" \u0026lt;\u0026lt;endl \u0026lt;\u0026lt; ; endl;
system ("pause");
for (a = 1, a \u0026lt;= 1000; a + +)
{
b = a% 2;
if (b == 1)
{
court \u0026lt;\u0026lt;a \u0026lt;\u0026lt;endl;}


} system ("pause");
court \u0026lt;\u0026lt;"Print the even numbers from 1 to 1000" \u0026lt;\u0026lt;Endl \u0026lt;\u0026lt;endl;
system ("pause");
for (d = 1, d \u0026lt;= 1000; d + +) {

c = d% 2;
if (c = = 0)

{court \u0026lt;\u0026lt;d \u0026lt;\u0026lt;endl;}


} system ("pause");
return 0;}

0 comments:

Post a Comment