Software Development Exam  >  Software Development Notes  >  Basics of Java  >  Code: Pascal's Triangle

Code: Pascal's Triangle | Basics of Java - Software Development PDF Download

Code: Pascal`s Triangle | Basics of Java - Software Development

Algorithm

  • Start
  • Let i be an integer number.
  • Let j be an integer number.
  • Let row be an integer number and initialize by 6.
  • Let coe be an integer number and initialize by 0.
  • Repeat step 7 to 14 until all value parsed.
  • Set i = 0 and check I <= row;
  • Set j = 1 and check j <= row-i;
  • Print space.
  • check if j==0 || i==0
  • set coe = 1;
  • Else
  • Set coe = coe * (i+j-1)/j;
  • Print coe.
  • End

package programs;  

public class Pattern11   

{  

    public static void main(String[] args)   

    {  

        int coe=1,rows = 6;  

     for(int i = 0; i < rows; i++) {  

            for(int space = 1; space < rows - i; ++space) {  

                System.out.print("  ");  

            }  

  

            for(int j = 0; j <= i; j++) {  

                if (j == 0 || i == 0)  

                    coe = 1;  

                else  

                    coe = coe * (i - j + 1) / j;  

  

                System.out.printf("%4d", coe);  

            }  

      System.out.println();  

        }     

    }  

   }  

The document Code: Pascal's Triangle | Basics of Java - Software Development is a part of the Software Development Course Basics of Java.
All you need of Software Development at this link: Software Development
60 videos|37 docs|12 tests

Top Courses for Software Development

60 videos|37 docs|12 tests
Download as PDF
Explore Courses for Software Development exam

Top Courses for Software Development

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Summary

,

video lectures

,

shortcuts and tricks

,

Code: Pascal's Triangle | Basics of Java - Software Development

,

Extra Questions

,

Previous Year Questions with Solutions

,

Code: Pascal's Triangle | Basics of Java - Software Development

,

mock tests for examination

,

pdf

,

Sample Paper

,

practice quizzes

,

Viva Questions

,

Semester Notes

,

past year papers

,

MCQs

,

Code: Pascal's Triangle | Basics of Java - Software Development

,

Exam

,

ppt

,

Objective type Questions

,

Free

,

study material

,

Important questions

;