/*
Name: WAP to print square star pattern
Author: Parveen Malik
Date: 18/09/11 02:12
*/
#include <stdio.h>
#include <conio.h>
static void print(int length, int width)
{
int j;
int i;
length--;
width--;
for(j = 0; j <= width; j++) {
for(i = 0; i <= length; i++) {
if(!i || !j || j == width || i == length)
putchar('s');
else
putchar('*');
}
putchar('\n');
}
}
int main(void)
{
print(6, 4);
getch();
return 0;
}
OUTPUT :
0 comments:
Post a Comment