Code.GeekInterview.com
 
Code Samples C++
 

Program to print asterisk(*) pattern in C++


Code ResourceAuthor: rachittyagi  

Difficulty Level: Intermediate

Published: 9th Nov 2010   Read: 21474 times  

Filed in: C++
Add Comment


 

 

Sponsored Links


 

 
Program to print an asterisk(*) pattern /* * * ** ** *** *** **** **** ********** */
 


Sample Code
  1. #include<iostream.h>
  2.  
  3. #include<conio.h>
  4.  
  5. void main()
  6.  
  7. {
  8.  
  9.     clrscr();
  10.  
  11.     int i,j,k,l,m;
  12.  
  13.     for(i=1;i<=5;i++)
  14.  
  15.   {
  16.  
  17.   cout<<"n";
  18.  
  19.     for(m=1;m<=i;m++)
  20.  
  21.         {
  22.  
  23.                     cout<<"*";
  24.  
  25.         }
  26.  
  27.            for(j=5;j>i;j)
  28.  
  29.             {
  30.  
  31.                      cout<<" ";
  32.  
  33.             }
  34.  
  35.          for(l=5;l>i;l)
  36.  
  37.           {
  38.  
  39.                    cout<<" ";
  40.  
  41.            }
  42.  
  43.        for(k=1;k<=i;k++)
  44.    
  45.  
  46.          {
  47.  
  48.                   cout<<"*";
  49.  
  50.           }
  51.  
  52.    }
  53.  
  54. getch();
  55.  
  56. }
Copyright GeekInterview.com


Next Article: Void Pointers


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification:
 
 Subscribe    



Popular Coders

# Coder NameHits
1. Priya60031
2. chowsys31062
3. bipin_vaylu21545
4. rachittyagi21475
5. raghu.mohindru14900
6. vimal.fire13965
7. venki_madesh13912
8. Subashini13691
9. Mehedi Shams Rony11947
10. vipin gupta11755

Active Coders

Refined Tags