Java Program to Reverse a Number

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.ย. 2024
  • In this Java Video Tutorial you will learn How to Write a Program to Reverse a Number entered by the user.
    Here we ask the user to enter a number and then we separate each digits from that number, and generate the number which will be the reverse of the given number.
    This program can help a beginner in Computer Programming to understand how to construct the logic, How to use loops effectively.
    our Social Media Pages
    / exampleprogram
    / exampleprogram
    / example_program
    Our Website
    www.ExamplePro...
    #JavaProgramming #ExampleProgram

ความคิดเห็น • 33

  • @AdrianTregoning
    @AdrianTregoning 2 ปีที่แล้ว +6

    Best explanation I've seen now. Thank you.

  • @dudem5447
    @dudem5447 2 ปีที่แล้ว +2

    THANK YOU!!! this is the only video i found that explains this problem!! thanks sir (edit: i found many videos that just show you the code but don't say anything about how it works).

  • @Anil_Y_channel
    @Anil_Y_channel 11 หลายเดือนก่อน +1

    Very good explanation i understand easily through ur bref explanation.thank you Very much

    • @ExampleProgram
      @ExampleProgram  11 หลายเดือนก่อน

      You are most welcome

  • @rstikh
    @rstikh ปีที่แล้ว +1

    thanks! you're amazing at explaining :)

  • @JJJJ-gl2uf
    @JJJJ-gl2uf ปีที่แล้ว +1

    Good work.

  • @anushkatupe9502
    @anushkatupe9502 8 หลายเดือนก่อน +1

    ❤❤❤❤goat

  • @betterthanyesterdayinc.3361
    @betterthanyesterdayinc.3361 2 ปีที่แล้ว +1

    Thank you

  • @sukritighoshdancer
    @sukritighoshdancer 2 ปีที่แล้ว +1

    Thank u sir

  • @shashanks7608
    @shashanks7608 3 ปีที่แล้ว +1

    Good video

  • @googleistrapman2681
    @googleistrapman2681 2 ปีที่แล้ว +1

    Nice bro

  • @paramgandhi5768
    @paramgandhi5768 ปีที่แล้ว

    how can we do this with for loop? as we have to mention the initial value and then increment or decrement too

  • @nsnikhil200
    @nsnikhil200 2 ปีที่แล้ว +1

    public class exercise {
    public static void main(String[] args)
    {
    int remainder, revNumber = 0;
    Scanner sc = new Scanner(System.in);
    System.out.println("Enter a three digit number(100 to 999)");
    int number = sc.nextInt();
    if (number > 99 && number < 1000) {
    while (number > 0) {
    remainder = number % 10;
    number = number / 10;
    revNumber = (revNumber * 10) + remainder;
    }
    System.out.println(revNumber);
    }
    else {
    System.out.println("It is not a three digit number");
    System.exit(0);
    }
    }

    • @lennoxabreo
      @lennoxabreo ปีที่แล้ว

      only issue with this is, it does not ask you to enter a number again. it stops running after sending the message it is not a three digit number.
      iterate again in while loop to ask for the user input again

  • @priyashyamnair3551
    @priyashyamnair3551 ปีที่แล้ว +1

    why we are using 10?

    • @ExampleProgram
      @ExampleProgram  ปีที่แล้ว

      decimal number system.
      it has 10 digits ( 0 - 9 )

  • @raazpj2317
    @raazpj2317 2 ปีที่แล้ว

    Why we dividing with 10

    • @moxddne4226
      @moxddne4226 2 ปีที่แล้ว

      to remove remainder

  • @renisha4949
    @renisha4949 ปีที่แล้ว

    Why we multiply by 10

    • @ExampleProgram
      @ExampleProgram  ปีที่แล้ว

      because here we are using decimal number system :)

    • @renisha4949
      @renisha4949 ปีที่แล้ว +1

      @@ExampleProgram thank you 👍

  • @SushilPal-lj9nr
    @SushilPal-lj9nr ปีที่แล้ว

    1 error in programm example like 1000