0
Write a number to print the series 2,4,6....10
To print series 2,4,6...10
6 Answers
+ 6
What language for the coding?
+ 3
Where is your try...?
Pls try first yourself..
+ 2
#include<stdio.h>
Void main()
{ int i;
for(i=1;i<=10;i++)
{
if(i%2==0)
{
printf("%d",i);
}}
}
This the C code solution.
0
[print(x) for x in range(2,11,2)]
This is the python code solution
0
js:
for(let i = 1; i++ < 10; i++)console.log(i);
0
When there is C solution, C# and C++ should be here too :D
C++:
#include <iostream>
int i = 1;
int main(){
std::cout << ++i << ", ";
return (++i < 10? main():0);
}
C#:
class Program{
void Main(){
for(int i = 1; i++ < 10; i++)System.Console.Write("{0}, ", i);
}
};