TermCommentPost For Do While Loop

26 Comments

    • import java.util.Scanner;
      public class input
      {
      public static void main(String args[])
      {
      Scanner in=new Scanner(System.in);
      int a,b,c,d,e;
      S.O.P(“Enter all numbers:”);
      a=in.nextInt();
      b=in.nextInt();
      c=in.nextInt();
      d=in.nextInt();
      e=in.nextInt();
      if(a>b&&a>c&&a>d&&a>e){
      S.O.P(“a is greater”);
      }
      if(b>a&&b>c&&b>d&&b>e){
      SOP(“b is greater”);
      }
      if(c>a&&c>b&&c>d&&c>e){
      SOP(“c is greater”);
      }
      if(d>a&&d>b&&d>c&&d>e){
      SOP(“d is greater”);
      }
      if(e>a&&e>b&&e>c&&e>d){
      SOP(“e is greater”);
      }
      else{
      SOP(“numbers are identical”);
      }
      }

  • Create a program that will print a series of numbers based on what was entered by the user.
    ex:
    Sample output
    1
    2
    3
    4
    Done

  • guys.. will you help me to create a program ..
    in that program you can see the switch statement,do while loop and if else !!
    thank you for reading.. this is my project ..
    thank you guys.. for help me!! muah!!!

    • int z = 1;

      switch(z)

      {

      case 0 :

      {

      System.out.println(“zero”);

      break ;

      }

      case 1 :

      {

      int x = z ;

      do

      {

      System.out.println(x);

      if(x==0)

      {

      System.out.println(“error”);

      break ;

      }

      else

      {

      x ++ ;

      }

      }

      while(x<=5);

      break ;

      }

      default :

      {

      System.out.println(z+” is > 1″);

      break ;

      }

      }

  • can I ask how to loop a java with choices like a, b , c, d and each letter has their own method that will only appear when selected Im asking is how to loop it when the process of the selected is finish how will it go back to choosing in the choices again

Sponsors

Facebook Fans