Skip to main content

Posts

Showing posts from December, 2018

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:  

C program Code to write Automata program

Write a program to half pyramid 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:

How to Create WIFI Hotspot from Ubuntu 18.04 on laptop Step by Step

How to create WIFI Hotspot on ubuntu 18.04 laptop to create a WIFI Hotspot in ubuntu 18.04 , you should be first connect via lan. then follow just few steps step1:  click on the top right buttons and click on WiFi option and then click on WiFi setting click on WI-FI setting step2:  first "Turn on" your WIFI and them Click those "three lines" step 3: click on "Turn o WiFi Hotspot" option step4: click ok Turn on the Hotspot now active on your laptop. and you can see the password and network name . thank you. i hope you understand.

C program to swap two number

C program to Swap two Number Code: #include<stdio.h> void main(){ int n1,n2,temp; printf("enter two number :"); scanf("%d %d", &n1,&n2); temp=n1; n1=n2; n2=temp; printf("after swaping two number %d  %d\n",n1,n2); } Output:

Matrix Substruction Using C program

Matrix Substruction Using C program Code: #include<stdio.h> void main(){ int first[100][100],second[100][100],sum[100][100],r,c,i,j; printf("enter row and colume :"); scanf("%d%d", &r,&c); printf("enter first matrix element : \n"); for(i=0;i<r;i++){ for(j=0;j<c;j++){ scanf("%d", &first[i][j]); } } for(i=0;i<r;i++){ for(j=0;j<c;j++){ printf(" %d ", first[i][j]); } printf("\n"); } printf("enter second matrix element : \n"); for(i=0;i<r;i++){ for(j=0;j<c;j++){ scanf("%d", &second[i][j]); } } for(i=0;i<r;i++){ for(j=0;j<c;j++){ printf(" %d ", second[i][j]); } printf("\n"); } printf("substraction  of the two matrix : \n"); for(i=0;i<r;i++){ for(j=0;j<c;j++){ sum[i][j]=first[i][j] - second[i][j]; printf(" %d ",sum[i][j]); } printf("\n"); } } Output:

Matrix Addition using C Program

Matrix Addition using C Program Code:  #include<stdio.h> void main(){ int first[100][100],second[100][100],sum[100][100],r,c,i,j; printf("enter row and colume :"); scanf("%d%d", &r,&c); printf("enter first matrix element : \n"); for(i=0;i<r;i++){ for(j=0;j<c;j++){ scanf("%d", &first[i][j]); } } for(i=0;i<r;i++){ for(j=0;j<c;j++){ printf(" %d ", first[i][j]); } printf("\n"); } printf("enter second matrix element : \n"); for(i=0;i<r;i++){ for(j=0;j<c;j++){ scanf("%d", &second[i][j]); } } for(i=0;i<r;i++){ for(j=0;j<c;j++){ printf(" %d ", second[i][j]); } printf("\n"); } printf("substraction  of the two matrix : \n"); for(i=0;i<r;i++){ for(j=0;j<c;j++){ sum[i][j]=first[i][j] - second[i][j]; printf(" %d ",sum[i][j]); } printf("\n"); } } Output:

Create a Dynamic Matrix using C Program

Create a Dynamic Matrix using C Program Code: #include<stdio.h> void main(){ int a[100][100],r,c,i,j; printf("enter row and colume :"); scanf("%d%d", &r,&c); printf("enter matrix element : \n"); for(i=0;i<r;i++){ for(j=0;j<c;j++){ scanf("%d", &a[i][j]); } } for(i=0;i<r;i++){ for(j=0;j<c;j++){ printf("%d", a[i][j]); if(j==c-1){ printf("\n"); } } } } Output:

Create a simple static Matrix using C programming

Create a simple static Matrix using C programming Code: #include<stdio.h> void main(){ int a[2][2]={{1,2}, {3,4}}; int i,j; for(i=0;i<2;i++){ for(j=0;j<2;j++){ printf("%d", a[i][j]); if(j==1){ printf("\n"); } } } } Output:

Update Ubuntu Linux and Linux Mint with out Terminal

Update Ubuntu Linux and Linux Mint with out Terminal step1: go your Linux operating system menu and open software update step2: check your software update available or not. if available then press enter and put your password . after putting password press enter and the system will start automatically update

Update Ubuntu Linux , Linux Mint with help of Terminal

Update Ubuntu Linux , Linux Mint with help of Terminal updating system is very good. you have to update our system every  once week . this is very easy you have to follow few steps. Step1: open a terminal (ctrl + alt + t) step2: write on terminal sudo apt-get update and press enter   step3: enter your password and press enter then automatically update your linux operating system if any update available  

Write a program to implement the SJF scheduling algorithm (Assignment-6)

Q3) 3. Write a program to implement the SJF scheduling algorithm. Test case: Input No of processes: 4 Burst time: 4 9 8 3 Code: #include<stdio.h> void main() { int bt[20],p[20],wt[20],tat[20],i,j,n,total=0,pos,temp; float avg_wt,avg_tat; printf("Enter number of process:"); scanf("%d",&n); printf("\nEnter Burst Time:\n"); for(i=0;i<n;i++) { printf("p%d:",i+1); scanf("%d",&bt[i]); p[i]=i+1; } for(i=0;i<n;i++) { pos=i; for(j=i+1;j<n;j++) { if(bt[j]<bt[pos]) pos=j; } temp=bt[i]; bt[i]=bt[pos]; bt[pos]=temp; temp=p[i]; p[i]=p[pos]; p[pos]=temp; } wt[0]=0; for(i=1;i<n;i++) { wt[i]=0; for(j=0;j<i;j++) wt[i]+=bt[j]; total+=wt[i]; } avg_wt=(float)total/n; total=0; printf("\nProcess\t Burst Time \tWaiting Time\tTurnaround Time"); for(i=0;i<n;i++) { tat[i]=bt[i]+wt[i]; tot