Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1.  public static double calcPoint(int x, int k, int m)
  2. {        
  3.           int y;
  4.           y = (k * x) + m;
  5.           return y;
  6.   }
  7.  
  8.   public static int[] calcLine(int x, int k, int m) {
  9.  
  10.       int[] calcArray = new int[x];                                                                                        
  11.        
  12.         if (x != 0)
  13.         {
  14.         int x1 = 1;
  15.             for(;x1 <= x;x1++)
  16.             {
  17.                 calcArray[x1-1] = (int) calcPoint(x1,k,m);  
  18.             }
  19.            
  20.         }
  21.         return calcArray;  
  22.  
  23.   }
  24.  
  25.   public static void printLine(int x, int k, int m) {
  26.  
  27.       int[] answer = calcLine(x,k,m);
  28.         System.out.println("---RESULTAT----------");
  29.        
  30.         for (int i = 1; i <= answer.length; i++) {
  31.             System.out.println("y(" + i + ") = " + answer[i-1]);
  32.         }
  33.         System.out.println("---------------------");
  34.  
  35.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement