*
# #
* * *
# # # #
* * * * *
# # # # # #
#include<stdio.h>
void main()
{
int i,j,n;
printf("enter the value of n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
{
if((i&1)==0)
{
for(j=1;j<=i;j++)
printf("# ");
}
else
{
for(j=1;j<=i;j++)
printf("* ");
}
}
printf("\n");
}
}
NOTE- i have compiled this program in codeblocks if u do it in turbo c++ use conio.h header file in the beginning and getch() a the last.
# #
* * *
# # # #
* * * * *
# # # # # #
#include<stdio.h>
void main()
{
int i,j,n;
printf("enter the value of n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
{
if((i&1)==0)
{
for(j=1;j<=i;j++)
printf("# ");
}
else
{
for(j=1;j<=i;j++)
printf("* ");
}
}
printf("\n");
}
}
NOTE- i have compiled this program in codeblocks if u do it in turbo c++ use conio.h header file in the beginning and getch() a the last.
No comments:
Post a Comment