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 […]

Scroll to top