Posted by : Waqas Javed Sunday, 28 September 2014

#include<stdio.h>;
#include<conio.h>;

void main(){
int i;
int k;
int j;
int l;
int m;
int n;
int o;


printf("Write an even no: ");
scanf("%d", &i);

while(i%2 == 1) {
printf("\n please write an Even No: ");
scanf("%d", &i);
}

k = i/2 -1;
j = 0;
l = 1;
m = 0;
n = 0;
o = i/2;


while(o > n){

while (k > j){
printf("-");
j++;
}

while(l > m){
printf("*");
m++;
}


if (k == j){
j = 0;
k--;
}

if( l == m){
printf("\n");
n++;
m = 0;
l++;
l++;
}
}


k = j = 0;
l = i-1;
m = 0;
n = 0;
o = i/2;


while(o > n){

while(k > j) {
printf("-");
j++;
}


while(l > m){
printf("*");
m++;
}


if (k == j){
j = 0;
k++;
}


if (l == m) {
printf("\n");
n++;
l--;
l--;
m = 0;
}
}

_getch ();
}



Leave a Reply

Subscribe to Posts | Subscribe to Comments

Popular Post

Powered by Blogger.

- Copyright © BSCS -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -