pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

ixpict private pastebin - collaborative debugging tool What's a private pastebin?


Posted by ixpict on Sat 2 May 14:51
report abuse | download | new post

  1. package helloworld;
  2.  
  3. /**
  4.  *
  5.  * @author ixpict
  6.  * @version 0.1a
  7.  *
  8.  */
  9. public class Main {
  10.    
  11.    
  12.     public static final int LINES = 10; // Так определяются константы
  13.    
  14.     public static void main(String[] args) {
  15.  
  16.        
  17.         int[][] p = new int [LINES] [];
  18.        
  19.         p[0] = new int[1];
  20.        
  21.         System. out. println(p [0] [0] = 1);
  22.        
  23.         p[1] = new int[2];
  24.        
  25.         p[1][0] = p[1][1] = 1;
  26.        
  27.         System.out.println(p[1][0] + " " + p[1][1]);
  28.        
  29.         for (int i = 2; i < LINES; i++){
  30.            
  31.             p[i] = new int[i+1];
  32.            
  33.             System.out.print((p[i][0] = 1) + " ");
  34.            
  35.             for (int j = 1; j < i; j++){
  36.                 //&#1074;&#1086;&#1090; &#1101;&#1090;&#1072; &#1092;&#1080;&#1075;&#1085;&#1103; &#1092;&#1086;&#1088;&#1084;&#1080;&#1088;&#1091;&#1077;&#1090; &#1094;&#1077;&#1085;&#1090;&#1088;
  37.                 System.out. print( (p[i][j] = p[i-1][j] + p[i-1][j-1]) + " ");
  38.             }
  39.            
  40.             System. out. println(p[i][i] = 1); // &#1101;&#1090;&#1072; &#1092;&#1080;&#1075;&#1085;&#1103; &#1076;&#1086;&#1087;&#1080;&#1089;&#1099;&#1074;&#1072;&#1077;&#1090; &#1077;&#1076;&#1080;&#1085;&#1080;&#1095;&#1082;&#1091; &#1074; &#1082;&#1086;&#1085;&#1077;&#1094;
  41.            
  42.         }
  43.        
  44.     }
  45.    
  46. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post