C Program to Print Multiplication Table – Single Table and N×N Grid

A multiplication table in C is printed using a for loop that multiplies a given number by each integer from 1 to 10. For a full N×N grid, two nested loops are used: the outer loop for the row, the inner loop for the column, with i * j at the intersection. This is one …

Prim’s Algorithm in C – Minimum Spanning Tree (MST)

Prim’s algorithm finds the Minimum Spanning Tree (MST) of a weighted undirected graph — the set of edges that connects all vertices at the lowest possible total cost. It works by growing a single tree: start at any vertex, then repeatedly add the cheapest edge that reaches a vertex not yet in the tree, until …

C Program to count the number of occurrences of particular word in a string

C Program that counts the particular word in the given string. For example in the string ” the string is the set of charterers” , Number of occurrences of “the” is:2. Read more about C Programming Language . /*********************************************************** * You can use all the programs on www.c-program-example.com * for personal and learning purposes. For …

Pattern Programs in C – 8 Star, Number and Alphabet Patterns with Code

Pattern programs in C use nested loops to print shapes made of characters — stars, numbers, or letters. They are among the most commonly set exercises in first-semester C programming courses because they teach how to control the exact number of characters printed per row by expressing it as a formula of the row number. …

C Program to find Binomial Coefficients

The binomial coefficient C(n, k) — read as “n choose k” — counts the number of ways to choose k items from a set of n distinct items, regardless of order. It appears in the expansion (x + a)ⁿ as the coefficient of each term, in probability calculations, in Pascal’s triangle, and in combinatorics. There …

Palindrome Program in C – Check Number (Iterative, Function, Recursive)

A palindrome program in C checks whether a number reads the same forwards and backwards. Numbers like 121, 1331, and 12321 are palindromes; 12345 is not. The standard technique is to reverse the digits and compare with the original. This page covers three versions: a simple iterative solution, a clean function-based version, and a recursive …