answersLogoWhite

0


Best Answer

int n; // the number you want to reverse

int rev_n = 0;

while (n > 0) {

// shift rev_n digits left

rev_n *= 10;

// put rightmost digit of n onto right of rev_n

rev_n += n % 10;

// remove rightmost digit of n

n /= 10;

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

The periods in this program are used to organize the indentations.

public static int (int num)

{

....String str1=num+"",str2="";

....for(int count=str1.length();count<=0;count--)

....{

........str2+=str1.charAt(count);

....}

....num=Integer.parseInt(str2);

....return num;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program WAP to print a given integer in the reverse order?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write a program that outputs a given characters in reverse?

write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)


Fox pro program to reverse the given number?

reverse programe in fox pro


Write a C program to extract a given word from a file?

program to extract a given word from a file


How can you write a program specification for a given report?

It is your face


Shell program for gcd of three given numbers?

write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html


How can you generate a palindrome from a given number?

You write the number and then follow it with the digits in reverse order.


Write a c plus plus program that counts the no. of 1 bit in a given integer?

int bitcount (unsigned n) { int bitc= 0; while (n) { ++bitc; n = n&amp;(n-1); } return bitc; }


Given the prime factorization of an integer how can you determine if our integer is a perfect square?

Given the prime factorization of an integer how can you determine if our integer is a perfect square?


How do you Write a program that determines the number of occurrences of each digit in a given integer n?

there could be a part in it like this: int num, digit; int count [10]; do { digit = num%10; num != 10; ++count[digit]; } while (num);


What is 63492063492064 as a fraction?

As given it is an integer. However, if redrafted as 0.634920634920634... at every Which is a recurring decimal to infinity. This decimal recurs at every sixth digit. So we say Let P = 0.634920634920634... 1000000P = 634920.634920634... Subtract 999999P = 634920 . 0 Note the decimals subtract to zero. P = 634920/999999 Cancel down by '3' 211640/333333 The answer!!!!! Subtract


How do you write a program to find number of zeros for the given number in c program?

Assuming the number is represented by a decimal integer, initialise a counter to zero, then repeatedly divide the number by 10 and until the number is zero. After each division, examine the remainder. Each time the remainder is zero, increment the counter. If the number is represented by a decimal float, repeatedly multiply by 10 until the value is an integer, then perform the previous algorithm.


Do I need to write a program to find a substring in a given string in c plus plus?

No.