/********** Program To Print Reverse Of A Number *******/
class Reverse
{
public static void main(String args[])
{
int i,s=0,a = 120;
int no[] = new int[10];
System.out.print("Original Number : "+a);
for(i=0;i<10;i++)
{
if(a!=0)
{
no[i] = a%10;
a = a / 10;
s++;
}
else
break;
}
System.out.print("\n\nReversed Number : ");
for(i=s;i>0;i--)
{
System.out.print(+ no[i] +" ");
}
}
}
/************ OUTPUT ************
* Original Number : 120
* Reversed Number : 0 1 2 */
Labels: Simple Program
2 comments:
Subscribe to:
Post Comments (Atom)
hey its sandy, here is the website i was talking about...... the website is here
hey its sandy, here is the website i was talking about...... the website is here