//WAP TO ADD DIGITS OF THE NUMBER #include <stdio.h> int main() { long int n; int sum = 0, digit; printf("Enter the number :--> "); scanf("%ld", &n); while(n != 0) { digit = n % 10; sum = sum + digit; n = n / 10; } printf("The sum of the digits is :--> %d", sum); return 0; }
- C: BASIC
- C: OPERATORS
- C: AREA OF SHAPES
- Find the Area of Circle
- Find Area of Semicircle
- Diameter, Circumference & Area of Circle
- Find Area of Triangle
- Find Third Angle of Triangle
- Find Area of Isosceles Triangle
- Find Area of Equilateral Triangle
- Find Perimeter of Square
- Find Area of Rectangle
- Find Perimeter of Rectangle
- Find Area of Parallelogram
- Find Area of Rhombus
- Find Perimeter of Rhombus
- C: VOLUME & SURFACE
- C: EQUATIONS
- C: IF – ELSE
- Check if Given Number is Positive
- Check if Given Number is Positive or Negative
- Check if Character is Vowel or Consonant
- Check Given Year is Leap Year or Not
- Check if Given Number is Odd or Even
- Find Maximum of Two Numbers
- Check if Candidate is Eligible for Driving Licence
- Print Gender
- Check Type of Triangle
- Check if Triangle is Valid or Not using Angles
- Check if Triangle is Valid or Not using Sides
- Find Maximum of Three Numbers.
- Print Grade Based on Percentage
- Check if Number is Integer or Float
- C: SWITCH – CASE
- C: FOR LOOP
- Hello World 10 times
- Print First n Numbers
- Print First n Natural Number in Reverse Order
- Print Odd Numbers Between 1 to n
- Print First n Odd Numbers
- Add All Numbers up to n
- Display a-z Characters
- Multiplication Table of 5
- Multiplication Table of m up to n
- Factorial of n
- Fibonacci Series using For Loop
- nPr using For Loop
- nCr using For Loop
- Count Number of Digits in Number
- Add Digits in Number
- Print First Digit of Number
- Print First and Last Digit of Number
- Swap First and Last Digit of Number
- Reverse Number using For Loop
- Print All Numbers from 1 to n Divisible by m
- Print All Divisors of Number
- Check if Number is Prime or Not
- Print First n Prime Numbers
- Print Prime Numbers Between 1 to n
- Print All Prime Numbers Between n and m
- Check if Number is Palindrome
- Print First n Palindrome Numbers
- Print Palindrome Numbers Between 1 to n
- Print Palindrome Numbers Between n and m
- Check if Given Number is Armstrong or Not
- Print First n Armstrong Number
- Print Armstrong Number Between 1 to n
- Print Armstrong Number Between n and m
- Check if Number is Krishnamurti Number or Not
- Check if Given Number is Perfect Square
- Check Number is Perfect Square, Armstrong or Prime
- Check if All Digits of Number Are Same or Not
- GCD of Two Numbers
- LCM of Two Numbers
- Print All Factors of a Number
- Find Prime Factors of Number
- C: WHILE LOOP
- Print “Hello world” 10 Times
- Print First n Numbers
- Print First n Numbers in Reverse Order
- Print odd numbers between 1 to n
- Print first n odd numbers
- Add First n Numbers
- Display a-z Characters
- Print multiplication table of 5
- Print Multiplication Table of m up to n
- Find Factorial of n
- Fibonacci Series
- Print nPr using While loop
- Print nCr using While loop
- Count number of digits in number
- Add Digits of Number
- Print First Digit of Number
- Print First and Last Digit of a Number
- Swap First and Last Digit of a Number
- Reverse The Number
- Print Numbers Between 1 and n Divisible By m
- Print All Divisor of Number
- Check if Number is Prime or Not
- Print First n Prime Numbers
- Print Prime Numbers Between 1 to n
- Print Prime Numbers Between n and m
- Check If Number is Palindrome
- Print First n Palindrome Numbers
- Print Palindrome Numbers Between 1 to n
- Print Palindrome Numbers Between n and m
- Check if Number is Armstrong
- Print First n Armstrong Numbers
- Print Armstrong Number Between 1 to n
- Print Armstrong numbers Between n and m
- Check if Number is Krishnamurthy Number
- Check if Number is Perfect Square
- Check Number is Perfect Square, Armstrong or Prime
- Check if All Digits of Number Are Same
- Calculate the GCD of Two Numbers
- Calculate LCM of Two Numbers
- Print All Factors of a Number
- Print Prime Factors of Number
- C: DO – WHILE
- C: BASE CONVERSION
- C: ARRAY
- Initialize and Print Array
- Scan and Print Array
- Print Array in Reverse Order
- Find Number of Elements in Array
- Find an Element from Array
- Sum of Array Elements
- Average of Array Elements
- Mean, Variance and Standard Deviation of Array
- Check if Array is Sorted
- Find Maximum and Minimum from Array
- Second Smallest and Second Largest Element
- Count Positive, Negative and Zeros in Array
- Sum of Positive and Negative Elements
- Compare Two Arrays
- Count Odd and Even Numbers from Array
- Find Occurrence of Element in Array
- Replace Array Elements by Given Value
- Delete Duplicates Element from Array
- Delete Element by Value from Array
- Delete Element by Location from Array
- Insert Element at Specific Position in Array
- Binary Search
- C: MATRIX
- Initialize and Print Matrix
- Scan and Print Matrix
- Add Two Matrix
- Multiply Two Matrix
- Find Norm and Trace of Matrix
- Find Row Sum and Column Sum of Matrix
- Find Sum of Diagonal, Non Diagonal Elements
- Traverse Matrix Helically
- Check if Matrix is Magic Matrix
- Print Upper and Lower Triangle of Matrix
- Compute Transpose of Matrix
- C: STRING
- Initialize and Print String
- Scan and Print String
- Read String using gets
- Find Length of String
- Reverse the String
- Count Occurrence of Character
- Compare Two Strings
- Copy String to Another String
- Concat Two Strings
- Check if String is Palindrome
- Remove White Spaces from String
- Remove Vowels from String
- Count Vowels, Consonants and White spaces
- Convert String to Upper, Lower & Toggle Case
- Menu Driven C Program to Convert String Cases
- Delete Given Character From String
- Insert Substring at Specific Location
- Find Substring from String
- Count Occurrence of Word in String
- Remove Given Word from String
- Check Valid User name and Password
- C: RECURSION
- Add Two Numbers using Recursion
- Add Digits of a Number using Recursion
- Factorial using Recursion
- Fibonacci Series using Recursion
- Maximum From Array using Recursion
- Add First n Numbers using recursion
- Sum of Elements of Array using Recursion
- Search Element from Array using Recursion
- Binary Search using Recursion
- GCD of Two Numbers using Recursion
- LCM of Two Numbers using Recursion
- Sum Natural Numbers using Recursion
- Reverse Number using Recursion
- Reverse String using Recursion
- Check Given Number is Palindrome or Not
- Check Given String is Palindrome or Not
- Calculate Power using Recursion
- Programs
- Tutorials
- MCQs
- Interview Questions
- Assignments
- Career
- Videos
More
Subscribe to Get Free Posts
-
codecrucks says:Thank you very much. You may be interested in my youtube...
-
Hossein says:
-
codecrucks says:
-
codecrucks says:
- algorithm analysis approaches asymptotic notation backtracking branch and bound center of area center of gravity center of sums complexity analysis composition control structure crisp operations crisp relation crisp set defuzzification difference divide and conquer dynamic programming efficiency example FIS FLC fuzzy inference system fuzzy logic fuzzy operations fuzzy relation fuzzy set fuzzy sets graph greedy algorithm introduction job scheduling knapsack Mamdani FIS max-min composition maxima methods operations proof properties relation sorting string matching terminologies travelling salesman problem