Loading ...

Arithmetic Operators and Operations – Verification in C Language

We all know that Arithmetic operators are used to performing arithmetic operations in C programming language. Before starting verification program here is a list of operators and their functions and examples. Basic Arithmetic Operators Operator: + Meaning: Addition Operator Example: 10 + 20 = 30 Operator: – Meaning: Subtraction Operator Example: 20 – 10 = 10 […]

Postfix Evaluation in C

  /* Evaluating postfix */ #include <stdio.h> #include <math.h> #define SIZE 50 /* Size of Stack */ #include <ctype.h> int s[SIZE]; int top=-1; /* Global declarations */ push(int elem) { s[++top]=elem; } int pop() { return(s[top–]); } main() { char pofx[50],ch; int i=0,op1,op2; printf(“\n\nRead the Postfix Expression ? “); scanf(“%s”,pofx); while( (ch=pofx[i++]) != ‘\0’) { […]

Ackermann Function

Ackermann Function is the simplest example of a well defined total function which is compatible but not primitive recursive. It grows faster than an exponential function. /* Ackermann Function */ #include<stdio.h> #include<stdlib.h> int count = 0, indent = 0; int ackermann(int x, int y) { count++; if(x<0 || y<0) return -1; if(x==0) return y+1; if(y==0) […]

Infix Expression to Post-fix (Reverse police) Notation

Here we just look out the code on Infix to Postfix expression notation. It is also known as Reverse police method. Find the full code snippet below. Sample Code of Reverse Police Method /* Infix expression to post-fix (Reverse police) notation RabinsXp.com */ #include<stdio.h> #include<ctype.h> #define MAX 100 typedef struct stack { int data[MAX]; int […]