Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //http://bgcoder.com/Contests/107/Telerik-Academy-Exam-1-6-December-2013-Evening
- import java.util.Scanner;
- public class twoFourEight {
- @SuppressWarnings("resource")
- public static void main(String[] args) {
- double a = new Scanner(System.in).nextDouble();
- double b = new Scanner(System.in).nextDouble();
- double c = new Scanner(System.in).nextDouble();
- double result = 0;
- if (b == 2)
- {
- result = a % c;
- }
- if (b == 4)
- {
- result = a + c;
- }
- if (b == 8)
- {
- result = a * c;
- }
- double remainder = result % 4;
- if (remainder == 0)
- {
- System.out.println((int)result / 4);
- }
- else
- {
- System.out.println((int)remainder);
- }
- System.out.println((int)result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement