हिंदी

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

Advertisements
Advertisements

प्रश्न

Write a program in Java to display the following pattern:

A
ab
ABC
abcd
ABCDE 

संक्षेप में उत्तर

उत्तर

public class Q12a{
public static void main(String args[])
{
String s = "abcde"; 
System.out.println("\n\n");

for (int i = 0; i <= 4; i++) 
{ for (int j = 0; j <= i; j++) 
{ if (i % 2 = 0)
System.out.print(Character.toUpperCase(s.charAtG))); 
else
System.out.print(Character.toLowerCase(s.charAtU))); 
}
System. out. println();
}
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 2: Library Classes - EXERCISES [पृष्ठ १८०]

APPEARS IN

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

Englishहिंदीमराठी


      Forgot password?
Use app×
Our website is made possible by ad-free subscriptions or displaying online advertisements to our visitors.
If you don't like ads you can support us by buying an ad-free subscription or please consider supporting us by disabling your ad blocker. Thank you.