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("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 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
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
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
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
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 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 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 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
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 java program
write a java program  write a program to print '*' in a circular form
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... is: "+reverse); } } Above example code takes the user input from console
swing program for decimal to binary
swing program for decimal to binary  swing program for decimal to binary
c program - Java Beginners
c program  Write a program to encrypt a string and decrypt
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
How to write Java Program
How to write Java Program  how to write a program to find average of 5 student marks
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
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 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
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
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
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  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 - Java Beginners
write a program  1. write a program that reads a string composed of 6 words then generate and print a word composed of the first letters of the 6 words.  Hi friend, Code to solve the problem : class FirstLetter
write program - Java Beginners
write program  write a java program that will read the values...]); } System.out.println(); } } } For more information on java visit to : http://www.roseindia.net/java/beginners/ Thanks
write a program
write a program  write a program add 2 no.s without use arithmetic,unary operaters in java
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
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
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
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
write a program to print
write a program to print   write a program to print following 1 2 3 4 5 4 3 2 1 1 2 3 4 4 3 2 1 1 2 3 3 2 1 1 2 2 1 1 1
C program to print the following
C program to print the following  Hello, Some one help me with a "C Program" to print the following as output: 4444444 4333334..., that is why I choosed Java Beginners, but please give me a C program
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
c program
c program  How to convert binary digits to decimal number without using power function
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
malloc in c example program
malloc in c example program  What is malloc in c? Please explain the term using an example in C program. Thanks
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
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 to print using for loop
Write a program to print using for loop  Write a program to print using for loop * * * *  
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
how to write this program? - Java Beginners
how to write this program?  (game:scissor,rock ,paper) A program that plays the sciccor-rock-paper game.Revise the program to let the user continuously play until either the user or the computer wins more than 4 times

Ads