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

Ads
 

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("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));
    }
}

Ads









Related Tutorials/Questions & Answers:
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
Advertisements
Write a program in Java to convert Decimal number into Binary number
Write a program in Java to convert Decimal number into Binary number  Hi, I have decimal number and I want to convert it to Binary. How to Write a program in Java to convert Decimal number into Binary number? Thanks
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
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
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
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 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
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
write a java program
write a java program  write a program to print '*' in a circular form
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
How to write Java Program
How to write Java Program  how to write a program to find average of 5 student marks
Reverse String Program in Java
Reverse String Program in Java We are going to describe about reverse string program in java. In this example reverses a string entered by the user. We... in String Java reverse string without using inbuilt functions
Write a C/C++ program to show the result of a stored procedure
Write a C/C++ program to show the result of a stored procedure   how to write this?? Write a C/C++ program to show the result of a stored procedure "PROCRESETMAIL" on database "USER_NOTIFY
write the java program?
write the java program?  1 11 121 1331 14641 15101051
Write java program?
Write java program?  1 11 121 1331 14641 15101051
write the java program?
write the java program?  1 11 121 1331 14641 15101051
Write java program?
Write java program?  1 11 121 1331 14641 15101051
WRITE A PROGRAM IN JAVA
WRITE A PROGRAM IN JAVA  How do I write a program in Java, have the program display a message with your name in it and a number (Hello john Smith!1... ten contiguous output statement. For example your output cuold be something like
WRITE A PROGRAM IN JAVA
WRITE A PROGRAM IN JAVA  Write program which accepts five students id,name,age,department,courses, taken and its grade. a. calculate its GPA . display all student information in ascending order
write a program in java.
write a program in java.  arrange the natural n umber in 5x5 matrix...; public class NumberSpiral{ public static void main(String[] args) { int n=5; int i, s = n,x=0, y=0; int arr [][]= new int [n][n]; i=n*n; while(i>=1
swing program for decimal to binary
swing program for decimal to binary  swing program for decimal to binary
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
write a program  write a program add 2 no.s without use arithmetic,unary operaters in java
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
Write a C language program to read two matrices and multiply them?
Write a C language program to read two matrices and multiply them?  Write a C language program to read two matrices and multiply them?   ...;stdio.h> #include <conio.h> int main() { int m, n, p, q, c, d, k, sum
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

Ads