pattern with sound
//print pattern with background sound..... keep your mother board speaker connected...... #include<stdio.h> #include<conio.h> #include<dos.h> void main() { int i,j,m,k=1,t=1;//,g; clrscr(); printf("enter the height"); scanf("%d",&m); printf("\n\n"); for(i=0;i<m;i++) { for(j=0;j<m;j++) { textcolor(t); textbackground(t+1); t++; sound(30*(k++)*2); if((i==0 || i==m-1) || (j==0 || j==m-1)) cprintf(" *"); else if(i==j) cprintf(" $"); else cprintf(" #"); delay(100); } printf("\n"); } nosound(); getch(); }