b

b

Tuesday, February 16, 2016

Ex. 6.2 & Ex. 6.3


Exercise solution Ex. 6.2, Ex. 6.3
=======================================================================
package exercise6_2;

import java.util.Scanner;

//********************************************************************************
// exercise6_2.java          To solve the exercise 6.2
//********************************************************************************

public class exercise6_2 {


public static void main(String[] args)
{
for (int num = 0; num <= 200; num += 2)
System.out.println (num);

}}

=====================================================================

package exercise6_3;

import java.util.Scanner;

//********************************************************************************
// exercise6_3.java          To solve the exercise 6.3
//********************************************************************************

public class exercise6_3 {


public static void main(String[] args)
{
for (int val = 200; val >= 0; val -= 1)
if (val % 4 != 0)
System.out.println (val);

}
         }

==================================================================

No comments:

Post a Comment