Write a number to print the series 2,4,6....10 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a number to print the series 2,4,6....10

To print series 2,4,6...10

2nd Sep 2020, 3:12 PM
Anjali
Anjali - avatar
6 Answers
+ 6
What language for the coding?
2nd Sep 2020, 3:17 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Where is your try...? Pls try first yourself..
2nd Sep 2020, 3:14 PM
Jayakrishna 🇮🇳
+ 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.
4th Sep 2020, 10:50 AM
Sadaf Shaikh
Sadaf Shaikh - avatar
0
[print(x) for x in range(2,11,2)] This is the python code solution
2nd Sep 2020, 4:12 PM
Bharath Kumar S P
Bharath Kumar S P - avatar
0
js: for(let i = 1; i++ < 10; i++)console.log(i);
2nd Sep 2020, 4:30 PM
nicolas turek
nicolas turek - avatar
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); } };
4th Sep 2020, 12:55 PM
nicolas turek
nicolas turek - avatar