The trapezoidal rule is the simplest method to approximate the definite integral of a function f(x) over the interval [a, b]. Given N equally space points (with a spacing of h) X0, X1, …, XN such that X0 = a and XN = b, the integral of f(x) can be approximated as the sum. [Read more…] about C calculating Integration using Trapezoidal Rule
Basic of C Programming
C Programming Basic
C calculating Integration using Trapezoidal Rule
C Program to find out root using Bisection
Given a function f(x) which is continuous in the interval [a, b] and satisfying the property hat f(a)*f(b) < 0, there exists a root of the function f(x) in the interval [a, b]. The bisection algorithm works as follows where t: and 8 are small values specified by the user. [Read more…] about C Program to find out root using Bisection
Const and volatile Qualifiers in C
The const qualifier tells the compiler that the variable’s value should not be changed once it has been initialized. If we declare a const variable as [Read more…] about Const and volatile Qualifiers in C
C Program for Return Value of main
We have been writing “return 0;” as the last statement of every main function we have developed so far. But since main is the first function to start, no function calls main. So, the question that arises is – “Where does the return value of main go?” The value is returned and stored by the operating system and can be used to guide further actions by the operating system using shell scripts/batch files. [Read more…] about C Program for Return Value of main
C Program using a function declaration with an undefined parameter list
#include <stdio.h> #include <Stdlib.h> int ff(); int main() { clrscr(); ff(); ff(2); ff(2,3,4); return 3; } int ff(int i,int j,int k) { printf(" \n Hello world %d %d %d\n",i,j,k); return 3; }
[Read more…] about C Program using a function declaration with an undefined parameter list
C Program for string encryption using Caesar cipher (shift encoding).
C program to encrypt text using one of the simplest ciphers known as the “Caesar cipher.” In this encryption scheme, we shift all characters by a given offset. For example, if we use an offset of 4, every occurrence of ‘A’ will be replaced by ‘E’, every occurrence of ‘B’ will be replaced by ‘F’, and so forth. The encrypted text can be decrypted by using the reverse process if know the offset used for the encryption. [Read more…] about C Program for string encryption using Caesar cipher (shift encoding).
C Program for Rational Approximations for Real Numbers
The C program computes the rational approximation to a given real number, i.e., given a real number val, the program computes a pair of integers N and D such that the fraction N/D is a good approximation to val. To do so, we use the following series of steps. [Read more…] about C Program for Rational Approximations for Real Numbers
C Program Calculation of Perfect Numbers
Perfect numbers are positive integers which have the special property that the sum of all their factors equals the number itself, e.g., 6 = 1+2+3. The C program finds and prints out all perfect numbers less than 1000. [Read more…] about C Program Calculation of Perfect Numbers
C Program for GCD of Two Integers using Euclid’s algorithm
The Greatest Common Divisor of two positive integers can be calculated iteratively by the following formula known as Euclid’s algorithm. You can see that this is a recursive definition with GCD(m,n) defined in terms of GCD(n,m%n).
[Read more…] about C Program for GCD of Two Integers using Euclid’s algorithm
c program to delete a substring from a text
c program to read a text, delete all the semicolons it has, and finally replace all ‘.’ with a ‘,’
C Program to Implement a Quiz Program
It is a program for a basic quiz on the C Programming Language. It can be updated to turn into a quiz on any subject. It uses a function, switch case, and loop. [Read more…] about C Program to Implement a Quiz Program
C program to extract the substring from a given string
C program to read, display, add, and subtract two distances. Distance must be defined using kms and metres
C program to Allocate space dynamically for the array
Storage of Signed Integers
To store signed integers, we need to reserve one bit for the sign of the integer. It is usual convention to use a 0 bit to indicate positive sign and a 1 bit to indicate a negative sign. [Read more…] about Storage of Signed Integers
c program to implement shell sort
c program to implement radix sort algorithm
c program to insert a number at a given location in an array
C Program to Merge two Unsorted Arrays
In this tutorial, we can learn c program to merge two unsorted arrays. In this c program, we enter two unsorted array elements are merge them into one array. [Read more…] about C Program to Merge two Unsorted Arrays
c program to delete a number from an array that is already sorted in ascending order
C program to delete a number from a given location in an array
C program to implement binary search
C program to insert a number in an array that is already sorted in ascending order
C program to find the array of integers contain a duplicate number
C program to sum the series
C program to sum the series 1/12+1/22+1/32 [Read more…] about C program to sum the series
C program to sum the series 1+1/2 + 1/3…+ 1/n
In this tutorial, we can learn C program to sum the series 1+1/2 + 1/3…+ 1/n. In this c program, we enter a number and and generate the sum of series. [Read more…] about C program to sum the series 1+1/2 + 1/3…+ 1/n