English

Write the program to display the following pattern: 15 14 13 12 1110 9 8 76 5 43 21 - Computer Applications

Advertisements
Advertisements

Question

Write the program to display the following pattern:

15    14    13    12    11
10     9      8      7
6       5      4
3       2
1

Answer in Brief

Solution

public class Q9c
{ public static void main(String arf])
{System.out.println("\n------------------);
int i; j, p = 15;
for (i = 5; i >= 1; i--)
{System.out.printin();
for (j = i; j >= 1; j--)
{System.out.print(p + "\t");
p--;
}}}
shaalaa.com
  Is there an error in this question or solution?
Chapter 1.1: Nested Loop - EXERCISES [Page 146]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.1 Nested Loop
EXERCISES | Q VI. 9. (c) | Page 146
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×