import java.io.*;
public class vektor {
public static void main(String args[]) throws Exception {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
System.out.println("");
System.out.println("> OPERASI VEKTOR<");
System.out.println("Masukkan banyaknya elemen vektor : ");
int k= Integer.parseInt(input.readLine());
int []v1=new int[k+1];
int []v2=new int[k+1];
int []v3=new int[k+1];
int []v4=new int[k+1];
int []v5=new int[k+1];
int []a=new int[k+1];
int []b=new int[k+1];
System.out.println("VEKTOR 1");
for (int i=1; i<=k; i++){
System.out.println("Masukkan vektor ke "+i+" : ");
v1[i]=Integer.parseInt(input.readLine());
}
System.out.println("");
System.out.println("VEKTOR 2");
for (int i=1; i<=k; i++){
System.out.println("Masukkan vektor ke "+i+" : ");
v2[i]=Integer.parseInt(input.readLine());
}
System.out.println("");
System.out.println("VEKTOR 3");
for (int i=1; i<=k; i++){
System.out.println("Masukkan vektor ke "+i+" : ");
v3[i]=Integer.parseInt(input.readLine());
}
System.out.println("");
System.out.println("VEKTOR 4");
for (int i=1; i<=k; i++){
System.out.println("Masukkan vektor ke "+i+" : ");
v4[i]=Integer.parseInt(input.readLine());
}
System.out.println("");
System.out.println("VEKTOR 5");
for (int i=1; i<=k; i++){
System.out.println("Masukkan vektor ke "+i+" : ");
v5[i]=Integer.parseInt(input.readLine());
}
System.out.println("");
System.out.println("PENJUMLAHAN VEKTOR");
System.out.print("{ ");
for(int i=1; i<=k; i++){
b[i]=v1[i]+v2[i]+v3[i]+v4[i]+v5[i];
System.out.print(b[i]);
if(i!=k){
System.out.print(" , ");
}
}
System.out.println(" } ");
System.out.println("");
System.out.println("PENGURANGAN VEKTOR");
System.out.print("{ ");
for(int i=1; i<=k; i++){
b[i]=v1[i]-v2[i]-v3[i]-v4[i]-v5[i];
System.out.print(b[i]);
if(i!=k){
System.out.print(" , ");
}
}
System.out.println(" } ");
System.out.println("");
System.out.println("PERKALIAN VEKTOR");
System.out.print("{ ");
for(int i=1; i<=k; i++){
b[i]=v1[i]*v2[i]*v3[i]*v4[i]*v5[i];
System.out.print(b[i]);
if(i!=k){
System.out.print(" , ");
}
}
System.out.println(" } ");
System.out.println("");
System.out.println("PEMBAGIAN VEKTOR");
System.out.print("{ ");
for(int i=1; i<=k; i++){
b[i]=v1[i]/v2[i]/v3[i]/v4[i]/v5[i];
System.out.print(b[i]);
if(i!=k){
System.out.print(" , ");
}
}
System.out.println(" } ");
System.out.println("");
System.out.println("Masukan pekalian sekalar :");
int x=Integer.parseInt(input.readLine());
System.out.print("\nvektor 1:[");
for (int i=1;i<=k;i++){
a[i]=v1[i]*x;
System.out.print(a[i]);
if(i!=k-0){
System.out.print(",");
}
}
System.out.println("]");
System.out.print("\nvektor 2:[");
for (int i=1;i<=k;i++){
a[i]=v2[i]*x;
System.out.print(a[i]);
if(i!=k-0){
System.out.print(",");
}
}
System.out.println("]");
System.out.print("\nvektor 3:[");
for (int i=1;i<=k;i++){
a[i]=v3[i]*x;
System.out.print(a[i]);
if(i!=k-0){
System.out.print(",");
}
}
System.out.println("]");
System.out.print("\nvektor 4:[");
for (int i=1;i<=k;i++){
a[i]=v4[i]*x;
System.out.print(a[i]);
if(i!=k-0){
System.out.print(",");
}
}
System.out.println("]");
System.out.print("\nvektor 5:[");
for (int i=1;i<=k;i++){
a[i]=v5[i]*x;
System.out.print(a[i]);
if(i!=k-0){
System.out.print(",");
}
}
System.out.println("]");
}
}
salam gundar bozz
BalasHapusgue anak 1IA20..
lu anak mana ya ?