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

C program to check palindrome.

C programming

#include<stdio.h>#include<conio.h>void main(){char str[10];int len,flag,i,j;clrscr();printf(“Enter a string:”);scanf(“%s”,str);len=strlen(str);for(i=0,j=len;i<=len,j>=0;i++,j–){if(str[i]==str[j])flag=1;else{flag=0; break; }}if(flag==1)printf(“PALINDROME!!”);elseprintf(“NOT A PALINDROME!!”);getch();} So lets have an explanation of the code. first of all what is palindrome palindrome is a string that remain same when reversed. so here in the program we are… Continue Reading

0

C program to find maximum number in an array.

C programming

#include<stdio.h>#include<conio.h>void main(){int i,max,a[5];clrscr();printf(“Enter elements of array:”);for(i=0;i<5;i++){scanf(“%d”,&a[i]);}max=a[0];for(i=0;i<5;i++){if(max<a[i]){max=a[i];} else max = max;}printf(“Maximum number in the given array is:%d”,max);getch();}   Here is the explaination of the code:- first of all we are declaring an array of size 5 you can take the size… Continue Reading