Star Pattern Printing Programs in C (SET 1)


PROGRAM 1              
star pattern in C :: futureX


*
**
***
****
*****
******

--------------------------------


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
printf("Enter the value");
scanf("%d",&k);
for(i=0;i<k;i++)
{for(j=0;j<=i;j++)
{printf("*");
}printf("\n");
}
}


PROGRAM 2


****
***
**
*

--------------------------------


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
printf("Enter the value");
scanf("%d",&k);
for(i=k;i>0;i--){
for(j=i;j>0;j--)
{printf("*");
}printf("\n");
}
}

PROGRAM 3


*
**
***
****
***
**
*

--------------------------------




#include<stdio.h>
#include<conio.h>
void main()
{int l;
int i,j,k;
printf("Enter the value");
scanf("%d",&k);
for(i=0;i<k;i++)
{for(j=0;j<=i;j++)
{printf("*");
}printf("\n");
}

for(i=(k-1);i>0;i--){
for(l=i;l>0;l--)
{printf("*");
}printf("\n");
}
}





0 comments:

Related Posts Plugin for WordPress, Blogger...
Copyright © 2013 futureX | Blogger Template by Clairvo