C Program to demonstrate modf function.

Write a C program to demonstrate modf function.modf() defined in the C math.h library.modf function breaks the double/float values to integral part and fractional part. Example: res = modf(3.142, &iptr) returns res=142 and iptr=3. Read more about C Programming Language . and read the C Programming Language (2nd Edition). by K and R. /************************************************************ You can …

Anagram Program in C – Check if Two Strings are Anagrams

An anagram is a word or phrase formed by rearranging all the characters of another. In C, the standard way to check if two strings are anagrams is to count character frequencies: if both strings have exactly the same character counts, they are anagrams — regardless of order. This page shows a complete anagram program …

C Program to check matrix is magic square or not

A magic square is a square matrix in which the sum of every row, every column, and both main diagonals is the same number (called the magic constant). This C program reads a square matrix and checks whether it is a magic square. Example: 8 1 6 3 5 7 4 9 2 Every row, …

C Program to Delete Vowels from a String (In-Place, O(n))

Deleting the vowels from a string is a classic C exercise because the obvious approach — remove a character, then shift everything after it left by one — is O(n²) and fiddly. The clean solution is the two-index in-place filter: one index reads every character, a second index writes only the characters you’re keeping, and …

C Program to demonstrate strspn function.

Write a C Program to demonstrate strspn function.The strspn() function returns the index of the first character in string1 that doesn’t match any character in string2. If all the characters of the string2 matched with the string1, strspn returns the length of the string1. Read more about C Programming Language . /************************************************************ You can use …

Draw a Circle in C — Midpoint Circle Algorithm (No graphics.h)

The classic way this exercise was taught — Turbo C’s <graphics.h> with initgraph() and circle(x, y, r) — hasn’t compiled on a mainstream system in decades: graphics.h was a Borland DOS library, not part of C. But the underlying question is still excellent: how does a computer decide which pixels form a circle? The answer …