0

C program to evaluate infix expression into postfix expression

C programming

#include<stdio.h> #include<conio.h> #include<string.h> #include<ctype.h> #define max 100 char st[max]; int top=-1; void push(char st[],char); char pop(char st[]); void infixtopostfix(char source[],char target[]); int  getpriority(char); int main() { char infix[100],postfix[100]; clrscr(); printf(“\n*******************************”); printf(“\nenter postfix expression\n”); gets(infix); strcpy(postfix,””); infixtopostfix(infix,postfix); printf(“\n the corresponding postfix… Continue Reading

0

Swapping two variables without and with using third variable.

C programming

#include<stdio.h> #include<conio.h> void swap1(int,int); void swap2(int,int); void main() { int a,b; clrscr(); printf(“Enter the values for a & b respectively:”); scanf(“%d%d”,&a,&b); swap1(a,b); swap2(a,b); getch(); } void swap1(int a,int b) {int c; printf(“\n Swap using third variable:”); c=a; a=b; b=c; printf(“\n… Continue Reading

2

C program to transpose of a matrix.

C programming

#include<stdio.h> #include<conio.h> void main() { int i,j,a[5][5],b[5][5],m,n; clrscr(); printf(“Enter the number of rows and columns for matrice:(max 5)”); scanf(“%d%d”,&m,&n); printf(“Enter the elements of matrix”); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf(“%d”,&a[i][j]); } } for(i=0;i<m;i++) { for(j=0;j<n;j++) { b[i][j]=a[j][i]; } } printf(“\nNew matrix… Continue Reading

0

C Program to subtract two matrices.

C programming

#include<stdio.h> #include<conio.h> void main() { int i,j,a[5][5],b[5][5],m,n,sum; clrscr(); printf(“Enter the number of rows and columns for matrices:(max 5)”); scanf(“%d%d”,&m,&n); printf(“Enter the elements of first matrix”); for(i=0;i<m;i++) {  for(j=0;j<n;j++)   {    scanf(“%d”,&a[i][j]);   } } printf(“Enter the elements of second matrix”); for(i=0;i<m;i++) {… Continue Reading

0

C program to add two matrices.

C programming

#include<stdio.h> #include<conio.h> void main() { int i,j,a[5][5],b[5][5],m,n,sub; clrscr(); printf(“Enter the number of rows and columns for matrices:(max 5)”); scanf(“%d%d”,&m,&n); printf(“Enter the elements of first matrix”); for(i=0;i<m;i++) {  for(j=0;j<n;j++)   {    scanf(“%d”,&a[i][j]);   } } printf(“Enter the elements of second matrix”); for(i=0;i<m;i++) {… Continue Reading