Cross pattern problem in C language
#include<stdio.h>
int main()
{
int a,b,c,d,e,f;
printf("Enter the number of rows :");
//(if the number is odd than row will be row+1)
scanf("%d",&a);
if(a%2 == 0){
a=a;
}
else{
a=a+1;
}
for(b=1;b<=a/2;b++){
for(c=1;c<=b;c++){
printf(" ");
}
for(d=1;d<=b;d++){
printf("*");
break;
}
for(e=(a-1);e>=2*b-1;e--){
printf(" ");
}
for(f=1;f<=b;f++){
printf("*");
break;
}
printf("\n");
}
for(b=1;b<=a/2;b++){
for(c=a/2;c>=b;c--){
printf(" ");
}
for(d=1;d<=b;d++){
printf("*");
break;
}
for(e=1;e<=2*b-1;e++){
printf(" ");
}
for(f=1;f<=b;f++){
printf("*");
break;
}
printf("\n");
}
return 0;
}
#include<stdio.h>
int main()
{
int a,b,c,d,e,f;
printf("Enter the number of rows :");
//(if the number is odd than row will be row+1)
scanf("%d",&a);
if(a%2 == 0){
a=a;
}
else{
a=a+1;
}
for(b=1;b<=a/2;b++){
for(c=1;c<=b;c++){
printf(" ");
}
for(d=1;d<=b;d++){
printf("*");
break;
}
for(e=(a-1);e>=2*b-1;e--){
printf(" ");
}
for(f=1;f<=b;f++){
printf("*");
break;
}
printf("\n");
}
for(b=1;b<=a/2;b++){
for(c=a/2;c>=b;c--){
printf(" ");
}
for(d=1;d<=b;d++){
printf("*");
break;
}
for(e=1;e<=2*b-1;e++){
printf(" ");
}
for(f=1;f<=b;f++){
printf("*");
break;
}
printf("\n");
}
return 0;
}