Question

In: Computer Science

Write a loop to print a list of numbers starting at 64 and ending at 339....

Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax. in java

Solutions

Expert Solution

PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE, IF YOU NEED ANY MODIFICATION THEN LET ME KNOW, I WILL DO IT FOR YOU

I first converted the number to string and then extracted first part and last part from string and then converted back to integer and compared and given the output

class A{
  public static void main(String[] args) {
    int num[] = {645678339, 65346339, 64234338, 64256339, 64339 };
    for(int i=0;i<num.length;i++){
      String s = num[i]+"";
      String s2 = ""+s.charAt(0)+s.charAt(1);
      int st = Integer.parseInt(s2);
      String s1 = ""+s.charAt(s.length()-3) + s.charAt(s.length()-2) + s.charAt(s.length()-1);
      int end = Integer.parseInt(s1);
      if(st == 64 && end==339)
        System.out.println(s);
    }
  }
}

Related Solutions

Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.(java language)
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
1.Write a loop to print a list of numbers starting at 64 and ending at 339....
1.Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax. 2. Write a switch statement that uses the colour of a swab sample of COVID testing vehicle to send a message to a local doctor. Use the messages given for each colour in the table below. Justify your answer. Colour Message Blue “No virus” Yellow “Needs to be under observation” Red “Needs to be admitted in COVID ward” 3.
Write a for-loop in MATLAB that generates a list of numbers such that each number is...
Write a for-loop in MATLAB that generates a list of numbers such that each number is the sum of the previous three. Initialize your list of numbers at the values of 0, 0 and 1. In other words, "0" is the first element of the list, "0" is the second element of the list, and "1" is the third element of the list. What is the 20th value in the list?
Please, write a loop to print odd numbers an array a with pointers backwards. You can...
Please, write a loop to print odd numbers an array a with pointers backwards. You can use a variable “size” for array size.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT