Show Mobile Navigation

Thursday, October 04, 2012

Desired pattern of star

Anonymous - 15:03
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,a[10],b,max=0;
clrscr();
printf("enter column size : ");
scanf("%d",&b);

for(i=0;i<b;i++)

{
printf("enter  a[%d] :  ",i+1);
scanf("%d",&a[i]);
}

for(i=0;i<b;i++)
{
if(max<a[i])
{
max=a[i];
}
}
for(i=0;i<b;i++)
printf("a[%d]\t",i+1);

printf("\n");
for(i=0;i<max;i++)
{
for(j=0;j<b;j++)
{
if(a[j]>i)
printf("*\t");

else
printf(" \t");
}
printf("\n");
}
getch();
}

0 comments:

Post a Comment

Comments : Read Them Or Add One to promote us