Computer Science, asked by priyanka200829, 2 months ago

A B C D E
A B C D
A B C
A B
A

plz solve the program...! (pattern program)​

Answers

Answered by anindyaadhikari13
0

Answer:

These are the required program for the given pattern. As no language is mentioned, I am writing in these language - Java, Python, C, C++

1. In Java.

public class Pattern   {

   public static void main(String args[])   {

       for(char i='E';i>='A';i--)  {

           for(char j='A';j<=i;j++)  {

               System.out.print(j+" ");

           }

         System.out.println();

       }

   }

}

2. In Python.

for i in range(5,-1,-1):

   print(*['A','B','C','D','E'][:i],sep=" ")

3. In C.

#include <stdio.h>

int main()  {

   for(char i='E';i>='A';i--)  {

       for(char j='A';j<=i;j++)

           printf("%c ",j);

       printf("\n");

   }

   return 0;

}

4. In C++.

#include <iostream>

using namespace std;

int main()  {

   for(char i='E';i>='A';i--)  {

       for(char j='A';j<=i;j++)

           cout << j << " ";

       cout << endl;

   }

   return 0;

}

Refer to the attachment for output.

•••♪

Attachments:
Similar questions