About 4,480,000 results
Open links in new tab
  1. c - program to find the sum of digits - Stack Overflow

    Nov 11, 2009 · how do I add up the sum of the digits of a number except for digits that repeat themselves in c?

  2. C Program for Sum the digits of a given number - GeeksforGeeks

    Aug 4, 2022 · Write a C program to find and display all Armstrong numbers between two given intervals. An Armstrong number (also known as a narcissistic number or pluperfect number) of a given number of digits is a number that is equal to the sum of its own digits each raised to the power of the number of digits.

  3. C Program to Calculate Sum of Array Elements - GeeksforGeeks

    Nov 21, 2024 · In this article, we will learn how to find the sum of elements of an array using a C program. The simplest method to calculate the sum of elements in an array is by iterating through the entire array using a loop while adding each element to the accumulated sum.

  4. C program to find sum of digits of a number - Codeforwin

    Jun 13, 2015 · Write a C program to input a number and calculate sum of digits using for loop. How to find sum of digits of a number in C program. Logic to find sum of digits of a given number in C programming.

  5. Sum of digits in C - Programming Simplified

    Calculate the sum of digits in C without the modulus operator C program to find the sum of digit(s) of an integer that does not use the modulus operator. Our program uses a character array (string) for storing an integer.

  6. C program to find sum of array elements - Codeforwin

    Jul 11, 2015 · To find sum of all elements, iterate through each element and add the current element to the sum. Which is run a loop from 0 to n. The loop structure should look like for (i=0; i<n; i++). Inside the loop add the current array element to sum i.e. sum = sum + arr [i] or even you can do sum += arr [i]. * C program to find sum of all elements of array

  7. c - Calculating the sum of integers in an array - Stack Overflow

    Nov 28, 2011 · int main() { //this the sum of integers in an array int array[] = { 22,2,2,1,5,4,5,7,9,54,4,5,4 },x,sum=0; int cout_elements = sizeof(array) / sizeof(int); for (x = 0; x < cout_elements; x++) { sum += array[x]; } printf("%d",sum); return 0; }

  8. C Program To Find Sum of Digits of A Number - NxtWave

    The c program to find sum of digits of a number can be written in a few different ways. The algorithm for it is as follows: Take a number as input. Divide the number by 10 and store the remainder in a variable. Add this remainder to a running sum. …

  9. Sum of digits of a Number in C - Simple2Code

    May 5, 2021 · This tutorial is to find the sum of digits of a number using for loop and while loop in C. You need to have knowledge of the following topics in C. To find the sum of the digits means to add all the digits present in the number. For example: consider a number 123, sum of the digits of 123 will be 1+2+3 = 6. Output:

  10. How to Calculate the Sum of Numbers in an Array Using Loops in C

    To calculate the sum of numbers in an array using loops in C, we iterate through each element of the array and add it to a sum variable. This can be achieved using for, while, or do-while loops. In this tutorial, we will explore different ways to compute the sum of an array with step-by-step explanations. 1. Using a for Loop to Calculate Sum.

  11. Some results have been removed
Refresh