1
0
forked from kalmar/DALGLI0

Usuń 'zad2/Main.java'

This commit is contained in:
Rafał Dąbkowski 2018-06-25 16:59:13 +00:00
parent 64d16bf282
commit 4226162bcd

View File

@ -1,54 +0,0 @@
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
ArrayList<Integer> f = new ArrayList<>();
ArrayList<Integer> g = new ArrayList<>();
int n;
Scanner scanner = new Scanner(System.in);
Polynomial polynomial;
System.out.print("Podaj n: ");
n = scanner.nextInt();
polynomial = new Polynomial(n);
System.out.print("Najwyższa potęga współczynników f: ");
n = scanner.nextInt();
for (int i = 0; i <= n; ++i){
System.out.print("x^" + i + " = ");
f.add(scanner.nextInt());
}
System.out.print("Najwyższa potęga współczynników g: ");
n = scanner.nextInt();
for (int i = 0; i <= n; ++i){
System.out.print("g^" + i + " = ");
g.add(scanner.nextInt());
}
// polynomial = new Polynomial(2);
// f.add(1);
// f.add(1);
// f.add(1);
// f.add(0);
// f.add(1);
//
// g.add(0);
// g.add(1);
// g.add(1);
ArrayList<Integer> result = polynomial.multiply(f, g);
for (Integer i : result){
System.out.print(i + " ");
}
System.out.println();
result = polynomial.divide(f, g);
for (Integer i : result){
System.out.print(i + " ");
}
// System.out.println();
// result = polynomial.nwd(f, g);
// for (Integer i : result){
// System.out.print(i + " ");
// }
}
}