Advertisement
ANCHI22

ejercicio uno

May 4th, 2012
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1.    import java.io.*;
  2.    public class digitos{
  3.       public static void main(String args[])throws IOException{
  4.          BufferedReader in=new BufferedReader(new InputStreamReader (System.in));
  5.          int n,ninv=0,a;
  6.        
  7.          System.out.print("ingrese numero: ");
  8.          n= Integer.parseInt(in.readLine());
  9.          
  10.          do{
  11.             a= (n%10);
  12.             n=n/10;
  13.             ninv = ninv*10+a;                      
  14.          }
  15.          while (n>0);
  16.          System.out.println("el numero en orden inverso es :  " +ninv);
  17.       }
  18.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement