Skip to main content

Posts

Automata Program Using C program

1) write Automata Program using 1 and 0 10101 01010 10101 01010 10101 Code : #include<stdio.h> int main(){ int i,j,n; printf("enter a number : "); scanf("%d",&n); for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ if((i%2==0 || j%2==1)&&(i%2==1 || j%2==0)) printf("1"); else printf("0"); } printf("\n"); } }  Output :   2) write Automata Program using 1 and 0 11111 10001 10001 10001 11111  Code: #include<stdio.h> void main(){ int i,j,rows,cols; printf("enter rows and cols : "); scanf("%d%d",&rows,&cols); for(i=1;i<=rows;i++){ for(j=1;j<=cols;j++){ if((i==1 || i==rows) || (j==1 || j==cols)) printf("1"); else printf("0"); } printf("\n"); } } Output:            

Automata Program Using C program

1) write Automata Program using 1 and 0 01010 10101 01010 10101 01010   code : #include<stdio.h> int main(){ int i,j,n; printf("enter a number : "); scanf("%d",&n); for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ if((i%2==0 || j%2==1)&&(i%2==1 || j%2==0)) printf("0"); else printf("1"); } printf("\n"); } } Output :   2) write Automata Program using 1 and 0 01110 10001 10001 10001 01110   Code:  #include<stdio.h> void main(){ int i,j,rows,cols; printf("enter rows and cols : "); scanf("%d%d",&rows,&cols); for(i=1;i<=rows;i++){ for(j=1;j<=cols;j++){ if((i==1 || i==rows) && (j==1 || j==cols)) printf("0"); else if((i==1 || i==rows) || (j==1 || j==cols)) printf("1"); else printf("0"); } printf("\n"); } } Output :

Automata Program Using C program

1) write Automata Program using 1 and 0 11111 10101 11111 10101 11111 Code :  #include<stdio.h> int main(){ int i,j,n; printf("enter a number : "); scanf("%d",&n); for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ if(i%2==0 && j%2==0) printf("0"); else printf("1"); } printf("\n"); } } OupPut :    2) write Automata Program using 1 and 0  111 1    1 1    1 1    1  111  Code: #include<stdio.h> void main(){ int i,j,rows,cols; printf("enter rows and cols : "); scanf("%d%d",&rows,&cols); for(i=1;i<=rows;i++){ for(j=1;j<=cols;j++){ if((i==1 || i==rows) && (j==1 || j==cols)) printf(" "); else if((i==1 || i==rows) || (j==1 || j==cols)) printf("1"); else printf(" "); } printf("\n"); } } Output: 

Automata Program Using C program

write Automata Program using 1 and 0  000 0    0 0    0 0    0  000  Code:  #include<stdio.h> void main(){ int i,j,rows,cols; printf("enter rows and cols : "); scanf("%d%d",&rows,&cols); for(i=1;i<=rows;i++){ for(j=1;j<=cols;j++){ if((i==1 || i==rows) && (j==1 || j==cols)) printf(" "); else if((i==1 || i==rows) || (j==1 || j==cols)) printf("0"); else printf(" "); } printf("\n"); } } Output: 

C program Code to write Automata Program

 write Automata Program using 1 and 0  1   1  111  111  111 1   1 Code: #include<stdio.h> void main(){ int i,j,rows,cols; printf("enter rows and cols : "); scanf("%d%d",&rows,&cols); for(i=1;i<=rows;i++){ for(j=1;j<=cols;j++){ if((i==1 || i==rows) && (j==1 || j==cols)) printf("1"); else if((i==1 || i==rows) || (j==1 || j==cols)) printf(" "); else printf("1"); } printf("\n"); } } Output:

C program Code to write Automata Program

 write Automata Program using 1 and 0  0   0  111  111  111 0   0 Code: #include<stdio.h> void main(){ int i,j,rows,cols; printf("enter rows and cols : "); scanf("%d%d",&rows,&cols); for(i=1;i<=rows;i++){ for(j=1;j<=cols;j++){ if((i==1 || i==rows) && (j==1 || j==cols)) printf("1"); else if((i==1 || i==rows) || (j==1 || j==cols)) printf(" "); else printf("1"); } printf("\n"); } } Output:

C program Code to write Automata Program

 write Automata Program using 1 and 0 10101 01010 10101 01010 10101 Code: #include<stdio.h> int main(){ int i,j,n; printf("enter a number : "); scanf("%d",&n); for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ if((i%2==0 || j%2==1)&&(i%2==1 || j%2==0)) printf("1"); else printf("0"); } printf("\n"); } } Output: