Menu
Question Index
...


Write a program to print the following character pyramid using the input string. Spaces at the beginning of the line and spaces between characters are important. Use System.out.println or System.out.print for printing.

Input (String) Printed Output
India      I
    I n
   I n d
  I n d i
 I n d i a
campus       c
     c a
    c a m
   c a m p
  c a m p u
 c a m p u s

class PrintFormation

{    public static void main(String s[])
    {
        printFormation("India");

    }


public static void printFormation(String name)
{
//Write code here to print string pyramid using name. Use System.out.println or System.out.print for printing.
}
}

Doubts

Problems

Topic: charAt() Method In Java - Java Character Extraction

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App