Home Answers Viewqa Java-Beginners Write a java program that prints the decimal representation in reverse. (For example n=173,the program should print 371.)c

 
 


Ayyanar
Write a java program that prints the decimal representation in reverse. (For example n=173,the program should print 371.)c
2 Answer(s)      a year and 11 months ago
Posted in : Java Beginners

class rose
{
int n;
int i;
rose(int n,int i)
{
n=173;
i=371;
}
void out
{
System.out.println("Enter the number"+n);
System.out.println("\nReverse the number"+i);
}
Public static void main(String args[]) 
{
System.out.println("Enter the number"+n);
System.out.println("\nReverse the number"+i);
S.out();
}
}
View Answers

June 15, 2011 at 2:49 PM


print("code sample");

June 15, 2011 at 3:13 PM


import java.util.*;

public class ReverseNumber {
    public static int reverse(int num){
        int n = num;
            int reversedNumber = 0;
            for (int i = 0; i <= num; i++) {
                int r = num % 10;
                num = num / 10;
                reversedNumber = reversedNumber * 10 + r;
                i = 0;
            }
            return reversedNumber;
    }
    public static void main(String[] args) {
            Scanner input = new Scanner(System.in);
            System.out.print("Enter number: ");
            int num = input.nextInt();
            System.out.println("Reversed Number: "+reverse(num));
    }
}









Related Pages:
Write a java program that prints the decimal representation in reverse. (For example n=173,the program should print 371.)c
Write a java program that prints the decimal representation in reverse. (For example n=173,the program should print 371.)c  class rose { int n; int i; rose(int n,int i) { n=173; i=371; } void out { System.out.println
Write a java program that prints out the following menu???
Write a java program that prints out the following menu???  Write a java program that prints out the following menu. Auser can interact with the menu using numbers (1,2,3,4,5,6). The menu will be printed again if the user enters
java program to convert decimal in words
java program to convert decimal in words  write a java program to convert a decimal no. in words.Ex: give input as 12 output must be twelve
String reverse program
String reverse program  write a java program for reverse string? if the string is "Hi welcome to hyderabad" the reverse string is "hyderabad to welcome Hi"   I hope you would have applied your logic before asking
Write a program in java...
Write a program in java...  Hi, friends Please, can you help me? Q1: Write a program in java to simulate a calculator. Your program should take two... to enter an integer number. Write a program in java to find the factorial
A Java Program That Prints Out Result Via Printer
A Java Program That Prints Out Result Via Printer  A Java Program That Prints Out Result Through Printer Depending upon paper size , and print the calculated result on printer and save result as text file
Convert Decimal to Octal
. Description of code: This program takes a decimal number at console and converts... parameters: value and 8.  And it converts the signed decimal representation...;} } Download this program. Output of this program:  C
C program - Java Magazine
, the program should print the following; The three integers form a Right-angled...C program  develop a simple program in C that allows a user to enter...", &c); if((a==b)&&(b==c)&&(c==a)){ printf("Equilateral Triangle \n
Convert Decimal into Binary
of this program: C:\corejava>java DecimalToBinary Enter the decimal value: 123 Binary: 1111011 C:\corejava>...; a decimal number into a binary number.  Description of program: This program
c++
c++  write a program that gets a key or character from the keyboard and displays it ASII code in decimal, hexadecimal and binary form.It must also give a description of the key pressed
A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer
A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer
A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer
A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer
A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer
write a program to use for loop print **********========== in c language
write a program to use for loop print **********========== in c language  write a program to use for loop print **========== in c language
write a program in C to print following triangles on the screen
write a program in C to print following triangles on the screen  write a program in C to print following triangles on the screen
Reverse integer array program
Reverse integer array program  Been tasked with the following question: Write a method that accepts an integer array and returns a new array with all the elements in reverse order. For example, if the input array is [2, 4, 6, 8
reverse arrays in java
reverse arrays in java  how do i write a program in array of size n*m where both n and m are greater than 20 such that the 1st element of an array becomes the last and vice verse
reverse
reverse  program to read a string and print the reverse string   Hi Friend, Try the following code: import java.util.*; public class ReverseString{ public static void main(String[]args){ Scanner input=new
Write a java application program........?
Write a java application program........?  Welcome every One : I have Q in Java? Q : Write a java application program that reads 20 integer numbers input by the user and prints how many numbers > 100 and how many numbers
c program - Java Beginners
c program  1. How to write a program to Add 2 numbers without using int .size should be more than machine size
Binary to decimal - Java Beginners
Binary to decimal  Need help pls.. i cannot run this program... pls correct my program... i really appreciate your answers... thank you very mucha... = Integer.parseInt(JOptionPane.showInputDialog("Input Binary:")); String c = args[0
c program - Java Beginners
c program  Write a program to encrypt a string and decrypt
A Program To Reverse Words In String in Java
Tell Me This Program.  Here is an example that reverse the words...A Program To Reverse Words In String in Java  A Program To Reverse Words In String in Java for example: Input:- Computer Software Output
converting From Hexadecimal to Decimal System - Java Interview Questions
converting From Hexadecimal to Decimal System  Write a program in Java user is required to enter a number system XVI and turn it into the decimal...': decimal += 500; break; case 'C': decimal += 100; break
Convert Octal to Decimal
of this program: C:\corejava>java OctalToDecimal Enter the octal number: 32 Decimal:=26 C:\corejava>_  ... to decimal. The following program helps you converts number octal to decimal
write following program
-threading. Explain with examples Q2 Write a java applet that takes your name... the state transition diagram of a thread Q6 Write a java applet that displays 9... is a java applet? Write a java applet to display "Hello JAVA". Also write the relation
program in c
program in c  Write a program that inputs five different integers from the keyboard, then print the sum, the product, the smallest and the largest of these numbers. Use only single selection form of if statement. For example: 1 3
Java binary to decimal
Java binary to decimal   ... you in understanding a how to get a 'Java binary to decimal'. For this we have... print the decimal value from the binary value.  BinarytoDecimal.java
Very simple `Hello world' java program that prints HelloWorld
step. This short example shows how to write first java application and compile... Hello World Java Simple Java Program for beginners... program, java codes are written in the java class.  class HelloWorld
Decimal Format Example
Decimal Format Example       In this example we are going to format a decimal value... DecimalFormatExample.java C:\convert\rajesh\completed>java
Convert Hexadecimal to Decimal
a hexadecimal number into decimal. Code Description: This program takes a hexadecimal...;} } Download this program: Output  of this program. C... Decimal:=50 C:\corejava>
Convert Decimal to Hexadecimal
;} } Download this program. Output of this program: C:\corejava>java... Convert Decimal to Hexadecimal       In this section, you will learn to convert a decimal data
Out of bounce exception in the string reverse program - Java Beginners
this program then that time used c:/>java StringReverseExample rose if you have any confuse then you can this program. i am sending reverse program code...Out of bounce exception in the string reverse program  In the given
Convert Decimal To Character
. In this example, we are going to convert decimal number to its corresponding character.... This program takes a decimal value. Type casting (char) d ) is done... of this program: Output of this program given below. C:\corejava>
c program
c program  How to convert binary digits to decimal number without using power function
Convert Decimal to Integer
a decimal number to an integer type number. Description Code: This program helps you...;} } Download this program: Output of this Program. C:\corejava>java DecimalToInteger Enter the Decimal number: 13
BINARY TO DECIMAL - Java Beginners
BINARY TO DECIMAL  HELP ME PLSS. PROGRAM THAT CONVERTS BINARY TO DECIMAL  Hi friend, Program to convert Binary To Decimal : import... " + decimal); } } For read information on Java : http
swing program for decimal to binary
swing program for decimal to binary  swing program for decimal to binary
Convert Decimal To Fraction
;  In this example, you will learn how to convert decimal number to Fraction. The following program you convert it into the decimal to fraction...; for the java component. This program takes a string type value and store it in an integer
c++ program
c++ program  Write a program which reads a text from the keyboard... of lines (b) Number of words (c) Number of characters Strings should be left justified and numbers should be right justified in a suitable field width
String Reverse in Java
String Reverse in Java       In this example we are going to reverse a given string... StringReverseExample.java C:\rajesh\kodejava>java StringReverseExample "hi how are you
C++Tutorials
and execute each program as it is studied. The diligent student will modify the example... of standard C libraries are written beginning with a c. In order for the program... class should be represented in C++ as an abstract class. The reasons include
C program
a function to print names of all students who joined in a particular year. (c)Write a function to print the data of a student whose roll number is given...C program  hi, here is my question: Create a structure to specify
java program (integer/decimal) - Java Beginners
java program (integer/decimal)  Accept a number from the user as command line arguments. The number could be an integer or decimal value. ? Display the absolute value of the input number ? Display the rounded off value
program of c
program of c  write a program in c to display a to z without using printf or scanf statements or header files
c program
c program  plz send me program for this. write a program to print the following code? (in c language) 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 11 2 3 4 5 6 7 8 9 10
write a program
write a program  write a program add 2 no.s without use arithmetic,unary operaters in java
c program
c program  plz send me program for this. write a program to print the following code? 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 11 2 3 4 5 6 7 8 9 10 11 12 3 4

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.