Last active
January 30, 2018 15:31
-
-
Save nelvson/d0c3ff59cf93805224f58ab555b0f703 to your computer and use it in GitHub Desktop.
Week 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @author nelvson | |
*/ | |
import java.util.Scanner; | |
public class Week2 { | |
public static void main(String[] args) { | |
Scanner reader = new Scanner(System.in); | |
int N = reader.nextInt(); | |
int M = reader.nextInt(); | |
int bagi = N/M; | |
int sisa = N%M; | |
System.out.printf("masing-masing %d\n",bagi); | |
System.out.printf("sisa %d\n",sisa); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @author nelvson | |
*/ | |
import java.util.Scanner; | |
public class Week2 { | |
public static void main(String[] args) { | |
Scanner reader = new Scanner(System.in); | |
double harga = reader.nextDouble(); | |
int jumlah = reader.nextInt(); | |
double kali = harga * jumlah; | |
System.out.printf("Hasil pembelian saham adalah: %.2f\n",kali); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @author nelvson | |
*/ | |
import java.util.Scanner; | |
public class Week2 { | |
public static void main(String[] args) { | |
Scanner reader = new Scanner(System.in); | |
char arr[][]= new char[3][3]; | |
for (int i=0;3>i;++i) | |
for (int j=0;3>j;++j) | |
arr[i][j] = reader.next().charAt(0); | |
for (int i=0;3>i;++i){ | |
for (int j=0;3>j;++j){ | |
if (j>0) System.out.printf(" "); | |
System.out.printf("%c",arr[j][i]); | |
} | |
System.out.printf("\n"); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @author nelvson | |
*/ | |
import java.util.Scanner; | |
public class Week2 { | |
public static void main(String[] args) { | |
Scanner reader = new Scanner(System.in); | |
char A = reader.next().charAt(0); | |
char B = reader.next().charAt(0); | |
char C = reader.next().charAt(0); | |
char D = reader.next().charAt(0); | |
char E = reader.next().charAt(0); | |
char F = reader.next().charAt(0); | |
char G = reader.next().charAt(0); | |
char H = reader.next().charAt(0); | |
char I = reader.next().charAt(0); | |
System.out.printf("%c %c %c\n", A, D, G); | |
System.out.printf("%c %c %c\n", D, E, F); | |
System.out.printf("%c %c %c\n", G, H, I); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment