Functions

C/C++ Program to Find GCD of Two Numbers Using Recursion

In this program we will use recursion and Euclid’s algorithm to find greatest common divisor of two numbers. The definition of Euclid’s algorithm is as follows: Also Read: C program to find factorial of any number using recursion Also Read: How to Convert a Recursive Function or Algorithm to Non-Recursive? C Program #include<stdio.h> int gcd(int n,int m) …

C/C++ Program to Find GCD of Two Numbers Using Recursion Read More »

C++ Templates: Program to Swap Two Numbers Using Function Template

What are Templates in C++? Templates help in defining generic classes and functions and hence allow generic programming. Generic programming is an approach where generic data types are used as parameters and the same piece of code work for various data types. Function templates are used to create family of functions with different argument types. …

C++ Templates: Program to Swap Two Numbers Using Function Template Read More »