मराठी

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

Advertisements
Advertisements

प्रश्न

Write a program in Java to display the following pattern:

ABCDE
ABC
A

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

उत्तर

public class Q12c{ 
public static void main(String args[]) 
{
s = "ABCDE";
System.out.printIn("\n\n");

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

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

APPEARS IN

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

Englishहिंदीमराठी


      Forgot password?
Use app×