Code.GeekInterview.com
 
Code Samples C++
 

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


Code ResourceAuthor: rachittyagi  

Difficulty Level: Intermediate

Published: 9th Nov 2010   Read: 15579 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. Priya51204
2. chowsys24135
3. bipin_vaylu18525
4. rachittyagi15580
5. raghu.mohindru12576
6. venki_madesh11498
7. Subashini11382
8. vimal.fire11044
9. vipin gupta9439
10. Mehedi Shams Rony9238

Active Coders

Refined Tags