Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static double calcPoint(int x, int k, int m)
- {
- int y;
- y = (k * x) + m;
- return y;
- }
- public static int[] calcLine(int x, int k, int m) {
- int[] calcArray = new int[x];
- if (x != 0)
- {
- int x1 = 1;
- for(;x1 <= x;x1++)
- {
- calcArray[x1-1] = (int) calcPoint(x1,k,m);
- }
- }
- return calcArray;
- }
- public static void printLine(int x, int k, int m) {
- int[] answer = calcLine(x,k,m);
- System.out.println("---RESULTAT----------");
- for (int i = 1; i <= answer.length; i++) {
- System.out.println("y(" + i + ") = " + answer[i-1]);
- }
- System.out.println("---------------------");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement