patternprogram_65 softethics

Pattern 65

C

#include<stdio.h>

int main()
{
  char i,j;

  for(i='A'; i<='E'; i++)
  {
    for(j='A'; j<=i; j++)
    {
      printf("%c",i);
    }
    printf("\n");
  }
  return 0;
}

C++

 #include<iostream.h>
 
 int main()
 {
 char i,j;
 
 for(int i ='A';i<='E';i++)
 {
 for(int j ='A';j<=i;j++)
 {
 cout<<char(i);
 }
 cout<<endl;
 }
 return 0;
 }

Java

     class PatternProg
     {
     public static void main(String args[])
     {
     char i;
     char j;
      
     for (i = 'A';i <= 'E';i++)
     {
     for (j = 'A';j <= i;j++)
     {
     System.out.print(i);
     }
     System.out.print("\n");
     }
      
     }
 }

C#

using System;

class PatternProg
{
  public static void Main()
  {
    char i;
    char j;

    for (i = 'A'; i <= 'E'; i++)
    {
      for (j = 'A'; j <= i; j++)
      {
        Console.Write(i);
      }
      Console.WriteLine();
    }
    Console.ReadKey(true);
  }
}

Python

for x in range(65, 70):
    for y in range(65, x + 1):
        print(chr(x), end="")
    print()

Tutorial (YouTube)

0 0 votes
Rate this Program
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments