Posts

Showing posts with the label C-programs

Dijkstra's Algorithm

Image
Introduction: Given a graph and a source vertex in graph, find shortest paths from source to all vertices in the given graph. Let's take a real life example:

C++ code to Calculate SquareRoot of a number using Recursion

Example:  Input: 25                  Output: 5                                       Input: 11                  Output:3

C++ Program for Power Function using Recursion

Example: Input:  N=5; x=3;                  Output: 125 #include <iostream>

Tower of Hanoi

Image
The Animation for the Tower of Hanoi is:

Geometric Mean for a given K Using Recursion

Example: For a given K find:                                         1 + 1/2 + 1/4 + 1/8 + ... + 1/(2^k) 

Return Sum of Digits of an Integer using Recursion

Example:                Input: 1234                Output: 10

Multiply two numbers using Recursion

This program is to multiply two numbers using Recursive function.

"Check a String is Pallindrome or Not" using Recursion

This program is to check whether a string is pallindrome or not using Recursion in C++. Example: Input: "malayalam"                 Output: Yes

C++ program to "Count Zeroes in an Integer" using Recursion

This program will show you How to count number of zeroes in a given integer using Recursion. Example:    Input:10208                     Output: 2

C++ program to "Convert String to it's corresponding Integer" using Recursion

In this program we'll learn How to convert a string into into corresponding integer value. Example: To convert string "1234" to its integer value 1234. #include <iostream> #include<string.h> #include<math.h>

Programme to Check whether a number is an Armstrong number

Image
Here you will know how to Check  whether a number is an Armstrong number or not . In this method we have used a while loop to check for an Armstrong number.I have also attatched the screenshots of the programme I have written and the generated output.

Calculating Factorial of a number in C-programming

Image
In this post you will gonna learn how to calculate factorial of a number in C-programming. In this method we will print the factorial of a number using for loop.This is one of the simple method of calculating the factorial of a number.