adding old solved challenges

This commit is contained in:
2024-10-15 11:03:57 -04:00
parent fa5ac5e089
commit 7ecd444efb
107 changed files with 1056 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package ReverseIntegers;
import java.util.Scanner;
public class ReverseIntegers {
public static int reverseInt() {
int revInt = 0, remainderInt = 0;
Scanner sc = new Scanner(System.in);
System.out.print( "Please enter a number => ");
int a = sc.nextInt();
while (a != 0) {
remainderInt = a % 10;
revInt *= 10;
revInt += remainderInt;
a /= 10;
}
return revInt;
}
public static void main(String[] args) {
System.out.println(reverseInt());
}
}