Advanced java questions -2

Write a program that prints the numbers between 258 and 393 (both inclusive) which do not end with 5. The program should print the output so as to have one value per line. The output would therefore follow the below format:


value1
value2
value3
.
..
.
so on
Solution:
public class Solution2 {

 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  int start = 258;
  int end = 393;
  for (int i = start; i < end; i++) {
   if(i%10 !=5){
    System.out.println(i);
   }
   
  }

 }

}


Post a Comment

Popular posts from this blog

Yield Price Sri Lanka - Android Application

Manage SOAPAction of the Out Message

Remove duplicate XML elements using XSLT