/* program printing stars equal to each
element in the list */
#include<stdio.h>
#include<conio.h>
void main()
{
int a[20], i, j, n;
clrscr();
printf("\n Enter the how many array
elements: ");
scanf("%d",&n);
printf("\n Enter %d elements:
",n);
for(i=0;i<=n-1;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
printf("\n
a[%d] = %d : ",i,a[i]);
for(j=0;j<a[i];j++)
printf("
*");
}
getch();
}
No comments:
Post a Comment