Cross Pattern

2 views
Skip to first unread message

UMAR ASGHAR

unread,
Dec 27, 2011, 7:24:12 AM12/27/11
to Learn C Language
#include<stdio.h>
#include<conio.h>
int main(){
clrscr();
int i,j,icontrol;

printf("enter the odd number\n");
scanf("%d",&icontrol);

for(i=0;i<icontrol;i++){
for(j=0;j<icontrol;j++){
if(icontrol%2==0){
printf("bad_input\n");
}
if(i==j&&i!=icontrol/2){
printf("\\");
}
if(i!=j){
printf(" ");
}
if(i==j&&i==icontrol/2){
textcolor(45);
cprintf("*");
}
if(i==icontrol-1-j&&i!=icontrol/2){
printf("/");
}
}
printf("\n");
}

getchar();

}
Reply all
Reply to author
Forward
0 new messages