answersLogoWhite

0


Best Answer

ALGORITHM EVEN

BEGIN

FOR ( num = 0; num <= 20; num++ )

BEGIN

IF ( num MOD 2 == 0 ) THEN

DISPLAY (num)

END IF

END FOR

END EVEN

in C:

#include <stdio.h>

int main (void) { puts ("0 2 4 6 8 10 12 14 16 18 20"); return 0; }

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

#include<iostream.h>

#include<stdlib.h>

int main( )

{

int i=1;

for( i = 1; i<20; i++)

{

if( i%2 == 1)

{

cout << "\n" << i ;

}

}

system("PAUSE");

return 0;

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

The following loops through the numbers, 2 at a time:

for (i = 2; i <= 200; i+=2)
System.out.print(i + " ");


Here is another version; loop through all the numbers, and check whether each number is even:

for (i = 1; i <= 200; i++)
if (i % 2 == 0) // Checks remainder of division by 2
System.out.print(i + " ");

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

public class even_no {

public static void main( String args[])

{

int x=2;

for(x=2;x<=100;x+=2)

{

System.out.println(x);

}

}

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

#include <iostream>

int main()

{

for(int i = 100; i >= 1; i--)

{

if(i % 2 != 0)

printf("%d\n", i);

}

return 0;

}

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

int i;

for (i=2; 2<=20; i+=2) printf ("%d\n", i);

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

No if...else is required; what condition do you need? Just use a loop. For example, in Java: for (int i = 1; i

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

Here are two options in Java: // Option 1, increment by 2 at a time: for (int i = 2; i

This answer is:
User Avatar

User Avatar

Wiki User

7y ago

Notepad++

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How would you write a program to display even numbers between 0-20?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

A is an application program that allows you to search for and display webpages?

what is an application program that allows you to search for and display web pages?Examples would be, Internet Explorer, FireFox, Opera, Crome and many more.


What would the display for the numbers 31-40 look like?

71


Write a C program to display odd numbers from 1 to n where n is accepted from user?

#include&lt;stdio.h&gt; main() { int i=0,j=0,n; printf("Enter a number:"); scanf("%d",&amp;n); printf("The first %d odd numbers are:-\n"); for(i=0;i&lt;=n;i++) { if(j%2!=0) printf("%d\n"j); j=j+1; } }


CAN a word processor program read encrypted data?

No, if it is coded it would display only set of meaningless characters.


How many times would a digital clock display the same numbers in a 24-hour day?

i think its 17


Does a calculator display the exact values of all irrational numbers?

No. An irrational number is one that does not repeat or finish, and a calculator cannot display millions of digits like an irrational number would have.


Write a C program to find the sum of all prime numbers?

Since there is an infinite set of prime numbers the answer would be infinity.


What is the difference between the commands you would have to execute to write a character to the display if you did not have BIOS?

wat


What numbers are between 12.0 and 29.0?

There are an infinity of numbers between 12.0 and 29.0 so it would be impossible to list them.


How many numbers between 44 and 81?

Between them, not including them it is 36. If you include these two numbers, it would be 38.


How can I transfer big files between computers?

You would need a program like DropBox. You would need to have a network connection between the two computers you want to use. Another program would be YouSendIt.


What is the sum of all the numbers from 1 to 240?

Any spreadsheet program would tell you... 28,920