Download presentation
Presentation is loading. Please wait.
1
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671 1 Java Programming Practice 5. Write a Java program to print a triangle of stars as in below where the length of the triangle is taken from the user. Program Output: Enter the length of the triangle: 6 * ** *** **** *****
2
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671 2 Java Programming Practice 6. Write a Java program to print a triangle of stars as in below where the length of the triangle is taken from the user. Program Output: Enter the length of the triangle: 6 * ** *** **** *****
3
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671 3 Java Programming Practice 7. Write a Java program to calculate and print the Factorial of input number. n!=nx(n-1)x(n-2)x … x 2 x 1 Program Output: Enter the Number: 20 The Factorial is: 2432902008176640000
4
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671 4 Java Programming Practice 8. Write a Java program to calculate and print the Factorial of input number. continue reading number till user enter zero. n!=nx(n-1)x(n-2)x … x 2 x 1 Program Output: Enter the Number: 5 The Factorial is: 120 Enter the Number: 3 The Factorial is: 6 Enter the Number: 8 The Factorial is: 40320 Enter the Number: 0 The Factorial is: 1
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.