Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /* irishstorm
- 13/12/2015
- Built this because i'm really bad and lazy when it comes to maths, Built with hill 2 cipers in mind.
- */
- public class modConverter
- {
- public static void main(String[] args)
- {
- Scanner input = new Scanner(System.in);
- int option = 0,
- result = 0,
- mod = 26;
- do
- {
- System.out.println("******** Modulo Converter ********");
- System.out.println("1.\tEnter a number to convert ");
- System.out.println("2.\tChange Mod (26 by Default) ");
- System.out.println("3.\tExit Program ");
- option = input.nextInt();
- switch(option)
- {
- case 1:
- System.out.print("Enter a number : ");
- int number = input.nextInt();
- result = number % mod;
- if (result < 0)
- result = result + mod;
- System.out.print(number + " mod " + mod + " is " + result + "\n\n");
- break;
- case 2:
- System.out.print("Enter a mod : ");
- mod = input.nextInt();
- System.out.print("\n");
- break;
- case 3:
- System.out.print("Exiting Program...\n\n");
- System.exit(0);
- break;
- default:
- System.out.print("Invalid Option - Please select an option 1 - 3.\n\n");
- }
- }
- while(option != 100000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement