Wednesday, November 13, 2013

/*WAP TO PRINT THE FOLLOWING FORMAT:
      *
      # #
      * * *
      # # # #
      * * * * *      


#include<stdio.h>
#include<conio.h>
 void main()
 {
int i;
int j;

clrscr();

for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
if(i%2!=0)
printf(" *");
else
printf(" #");
}
printf("\n");
}
getch();
 }












#include<stdio.h>
#include<conio.h>
 void main()
 {
int i,j;
int row,space;

clrscr();

printf("Enter the no. of rows you want= ");
scanf("%d",&row);
clrscr();
space=row-1;
for(i=1;i<=row;i++)
{
for(j=1;j<=space;j++)
{
printf("  ");
}
for(j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
space=space-1;
}
getch();
 }

No comments:

Post a Comment