C Programming Examples

Sum of Digits in C Programming

Program to calculate sum of digits in C of a number using loop, explained logic and test cases. Example, Input number: 123 Output = 1+2+3 =6 Logic to find sum of digits: Have two variables” sum” and “remainder” with initial value 0. loop through the number Get remainder of the number with modulus 10. e.g. […]

String length in C without using strlen

Program example to find string length in C programming without using strlen function. Two program examples are shown one using for loop and another using while loop. String length in C without using strlen but for loop This c program example demonstrates how to calculate length of string without using strlen library function. It will […]

Length of string in C

Program to find length of string in C language using the library function strlen() . Also, includes example of length of string in C programming with user input string. It should be noted that the length of an string can also be calculated without using strlen function. C program to find length of string using […]

Scroll to top