Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

c Program for Sum of the digits of a given number

// C program to compute sum of digits in
// number.
#include <stdio.h>
 
/* Function to get sum of digits */
int getSum(int n)
{
    int sum = 0;
    while (n != 0) {
        sum = sum + n % 10;
        n = n / 10;
    }
    return sum;
}
 
// Driver code
int main()
{
    int n = 687;
    printf(" %d ", getSum(n));
    return 0;
}
Comment

digit sum number in c

#include <stdio.h>

int main() {
    int number;
    int sum=0,reminder;
    printf("enter the number:");
    scanf("%d",&number);
    while (number>0){
        rem=number%10;
        sum=sum+rem;
        number = number/10;
    }
    printf("%d",sum);
}
Comment

sum number in c

#include<stdio.h>
int main()
{
	int a,b;
    printf("enter numbers:");
    scanf("%d %d",&a,&b);
    printf("sum is:%d",(a+b));
}
Comment

the sum for numbers in c

#include <stdio.h>

void main (){

int i = 0  , s  =0 ;
while (i<=10){
s  = s + i ;
i++ ;
}
}
Comment

how to count digits and sum of digits in C

Enter the number
300
Given number = 300
Sum of the digits 300 = 3
 
 
Enter the number
16789
Given number = 16789
Sum of the digits 16789 = 31
Comment

PREVIOUS NEXT
Code Example
Typescript :: method swap to the Pair class of that swaps the first and second elements value of the pair in generic Pair class in java 
Typescript :: access dict elements with dot 
Typescript :: take two inputs from user and add them using callback function 
Typescript :: stats normal 
Typescript :: when we dont have to show data of child but change in child should be displayed in parent automatically 
Typescript :: nativescript routerextensions navigate 
Typescript :: input adresse ville automatique 
Typescript :: ts push in array 
Typescript :: inherit with filter typescript 
Typescript :: Bitwarden CLI Cheatsheet 
Typescript :: Convert Tupe to Object TypeScript 
Typescript :: vba check if two sheets are the same 
Typescript :: scale a vector 
Typescript :: react cra ts custom outputdir 
Typescript :: cant find the name console 
Typescript :: .htaccess Preventing requests with invalid characters 
Typescript :: ring Composition and Returning Objects and Lists by Reference 
Typescript :: products = product.object.all() python 
Typescript :: how to set up vuex with typescript 
Typescript :: does key repeats in hashmap 
Typescript :: dots are displaying only when trying to fetch records html template 
Typescript :: RuleTester.only(...) 
Typescript :: Integer Which of the following can be described as the decision whether to obtain the necessary software from internal or external sources?and Development Environment meaning 
Typescript :: number of elements in circular queue 
Typescript :: kubernetes imagepullsecrets different namespace 
Typescript :: ts Template pattern 
Typescript :: i like 
Typescript :: circular indicator gets whole page flutter 
Typescript :: multiple if statements in excel 
Typescript :: angular input change event datatype typescript 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =