patternprogram_70 softethics

Pattern 70

C

#include<stdio.h>

int main()
{
  int i,j;

  for(i=1; i<=5; i++)
  {
    for(j=5; j>=i; j--)
    {
      printf("*");//put any character
    }
    printf("\n");
  }
  return 0;
}

C++

 #include<iostream.h>
 
 int main()
 {
 
 for(int i=1;i<=5;i++)
 {
 for(int j=5;j>=i;j--)
 {
 cout<<"*";   // any character or symbol '#' etc
 }
 cout<<endl;
 }
 return 0;
 }

Java

     class PatternProg
     {
     public static void main(String args[])
     {
       for(int i=1;i<=5;i++)
       {
        for(int j=5;j>=i;j--)
       {
        System.out.print("*");
       }
       System.out.println();
      }    
     } //end of main
    }  //end of class

C#

using System;

class PatternProg
{
  public static void Main()
  {
    for (int i = 1; i <= 5; i++)
    {
      for (int j = 5; j >= i; j--)
      {
        Console.Write("*");
      }
      Console.WriteLine();
    }
    Console.ReadKey(true);
  } //end of main
} //end of class

Python

for x in range(1, 6):
    for y in range(6, x, -1): 
        print("*", end="")
    print()

Tutorial (YouTube)

5 1 vote
Rate this Program
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Bhamidimarri S Surya Narayana Jagannath

helping a lot in patterns