मराठी

Write a program in Java to display the following pattern: PRTVPRTPRP - Computer Applications

Advertisements
Advertisements

प्रश्न

Write a program in Java to display the following pattern:

PRTV
PRT
PR
P

थोडक्यात उत्तर

उत्तर

public class Q12d{ 
public static void main(String args[]) 
{
s = "PRTV";
System.out.printin("\n\n");

for (int i = s.length() - 1; i >= 0; i--)
{for (int j = 0; j <= i; j++)
System.out.print(s.charAt(j) + " ");

System.out.println();
}
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 2: Library Classes - EXERCISES [पृष्ठ १८०]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
पाठ 2 Library Classes
EXERCISES | Q VIII. 12. (d) | पृष्ठ १८०
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×