Pattern 1

Pattern 1 post thumbnail image

C

 #include<stdio.h>
 int main()
 {
   int i,j;
   for(i=1; i<=5; i++)
   {
     for(j=1; j<=5; 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=1;j<=5;j++)
  {
  cout<<"*";
  }
  cout<<endl;
  }
  return 0;
  }

Java

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

C#

using System;
 class PatternProg
 {
   public static void Main()
   {
     for (int i = 1; i <= 5; i++)
     {
       for (int j = 1; j <= 5; j++)
       {
         Console.Write("*");
       }
       Console.WriteLine();
     }
     Console.ReadKey(true);
   }
 }

Python

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

Tutorial (YouTube)

5 13 votes
Rate this Program
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Madhuri Mehta

Thank you Sir. Awesome explanation

Related Patterns