answersLogoWhite

0

class even
{
public static viod main(String args[])
{
System.out.println("<------even number from 1 to 1000------>");
for(int i=1;i<=1000;i++)
if(i%2==0)

System.out.print(i+" ");

}

}

Here is another way:
for (int i = 2; i <= 1000; i += 2)
System.out.print(i + " ");

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Q2 Write a program to print even numbers between 10 and 50?

You can use int i; for (i = 10; i &lt;= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.


Write the program witch show that the number is even or odd?

In BASIC: 10 INPUT X: IF X = 999 THEN STOP ELSE PRINT X; 20 IF X/2 = INT(X/2) THEN PRINT "EVEN" ELSE PRINT "ODD" 30 GOTO 10


How do you Write a C program to print a Series of Odd Numbers and Even Numbers.?

Reference:http:cprogramming-bd.com/c_page2.aspx# strange number


Program to print all the even numbers of an array in visual basic?

find even number in array


Write a c program to print or view tha summation of the even numbers from 100 to 200?

printf ("100+...+200=%d\n", ((100+200)/2)*(202-100)/2);


How do you write a C program to check whether the number is odd or even Ps-using DEV complier?

To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.


Write a program to print even and odd numbers in between 1 to 10?

for (int i = 2; i < 10; i ++) printf("%d\n", i); You did say even and odd numbers between 1 and 10. That's allnumbers between 1 and 10.


Write a basic program to print even and odd numbers in between 1 to 10?

# include&lt;stdio.h&gt; void main() { int i = 1; while(i&lt;11) { if(i%2==1) { printf("\n%d",i); } i++; } }


How do you write a program to print even numbers from 1 to 50 in PHP?

Code Below: &lt;?php $j = 100; // Set limit upper limit echo "Even Numbers are: &lt;br/&gt;"; for($i=1;$i&lt;=$j;$i++) { if($i%2) { continue; } else { echo $i."&lt;br/&gt;"; } } ?&gt;


Write an algorithm to print sum of all even numbers?

Start print "the sum of all even numbers is infinite" end


How do you print nos from 10-0 then only even nos are printed in a program flowchart?

10


Program for check a number is even or odd using PYTHON language?

This program checks whether a number is odd or even. NOTE: This site removes formatting from answers. Replace (tab) with a tab or four spaces. #!/usr/bin/python print("Type a number.") n = input(": ") l = len(n)-1 even = ("02468") if n[l] in even: (tab)print(n, "is even.") if n[l] not in even: (tab)print(n, "is odd.")