Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Soal No.1
- import java.io.*;
- import java.util.Scanner;
- public class Solution {
- public static void main(String[] args) {
- Scanner masuk = new Scanner(System.in);
- long N = masuk.nextLong();
- long x,y;
- x = masuk.nextLong();
- y = masuk.nextLong();
- if((N%x==0)&&(N%y==0)){
- System.out.print("Sangat Takut");
- }
- else if((N%x==0)||(N%y==0)){
- System.out.print("Takut");
- }
- else {
- System.out.print("Tidak Takut");
- }
- }
- }
- ------------------------------------------------------------------
- //Soal No.2
- import java.io.*;
- import java.util.Scanner;
- public class Solution {
- public static void main(String[] args) {
- Scanner masuk = new Scanner(System.in);
- long M = masuk.nextLong(),N = masuk.nextLong();
- if((M<0)||(N<0)){
- if((M<0)&&(N<0)){
- M = M*-1;
- N = N*-1;
- }
- else if((M<0)&&(N>=0)){
- M = M*-1;
- }
- else if((N<0)&&(M>=0)){
- N = N*-1;
- }
- }
- if(M==N){
- System.out.print("Nilai sama");
- }
- else if(M<N){
- System.out.print("Sudah terurut");
- }
- else if(M>N){
- System.out.print(N+" "+M);
- }
- }
- }
Add Comment
Please, Sign In to add comment