Algorithm


Problem Name: beecrowd | 1059
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1059

Even Numbers

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

Write a program that prints all even numbers between 1 and 100, including them if it is the case.

Input

In this extremely simple problem there is no input.

Output

Print all even numbers between 1 and 100, including them, one by row.

Input Sample Output Sample
 

2
4
6
...
100

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>
int main()
{
    int n = 100,i;
    for( i =2; i  < = n; i=i+2)
    {
    printf("%d\n", i);
    }

    return 0;
}
Copy The Code & Try With Live Editor

Output

x
+
cmd
2 4 6 ... 100

#2 Code Example with C++ Programming

Code - C++ Programming


#include <iostream<
using namespace std;

int main() {
	
	for (int i = 1; i  < = 100; i++) {
		
		if (i % 2 == 0) {
			cout << i << endl;
		}
	}
	return 0;
}
Copy The Code & Try With Live Editor

Output

x
+
cmd
2 4 6 ... 100

#3 Code Example with Python Programming

Code - Python Programming


start, end = 1, 100
# iteration
for num in range(start, end + 1):
   # check
   if num % 2 == 0:
      print(num)
Copy The Code & Try With Live Editor

Output

x
+
cmd
2 4 6 ... 100
Advertisements

Demonstration


Previous
#1052 Beecrowd Online Judge Solution 1052 Month- Solution in C, C++, Java, Python and C#
Next
#1060 Beecrowd Online Judge Solution 1060 Positive Numbers - Solution in C, C++, Java, Python and C#