What would you like to do?

# Program in c language to find the sum of digits?

# Program in c language to find sum of digits using recursion?

int Sum( int digits ) { if(digits < 10) return digits; return digits%10 + Sum(digits/10); }

# Using the C or similar programming languages how can you find the sum of 2 big number?

There are big number libraries or (large number libraries) for computations like that.

# C program for sum of first and last digit of a number?

/*this v'll work to obtain sum of 1st and last number of any number */ #include int main() { int num,sum=0,i,fd,ld; printf("enter the number); scanf("%d",&num); ld…=n%10; //will get the last digit while(num!=0) { fd=n; n/10; //to get the 1st digit } sum=fd+ld; //add 1st n last digit printf("\\n sum of 1st n last digit is %d",sum) }

# Program to find sum of two numbers in VB.NET language?

Option Explicit Dim a as integer Dim b as integer Dim c as integer Dim result as integer a=val(text1.text) b=val(text2.text) c=val(text3.text) result=a+b+c '…now we want to push the result to another text box ,below code insert into the button click event text4.text=result text1.text="" text2.text="" text3.text="" Rename the cmd button As sum. And run the program by pressing F5 key.

# Write a c program to get a 5 digit number as input and find the sum of the digit using recursion?

Something like this: http://codepad.org/ua952rap

# C program to find the sum of the digits of a number?

Here You go........... # include # include void main() { int no,sum=0,rem=0; clrscr(); printf("\\nEnter a Number: "); scanf("%d",&no); while(no>0) { rem=no%10; sum=sum+rem; n…o=no/10; } printf("\\nSum of digits of a number: %d",sum); getch(); }

# C program to find the sum of odd positioned digits and even positioned digits of a number seperately?

include #include main() { int n,s,r,t; clrscr(); printf("enter n"); scanf("%d",&n); s=0;t=0; while(n!=0) { r=n%10; { if(r%2!=0) t=t+r; if(r%2==0) s=s+r; } n=n/10; } printf("s…um of even position digits%d\\n",s); printf("sum of odd position digits%d\\n",t); getch(); }

# Java program to find the sum of digit of a number and reverse it?

public SumRevInt(String args) { System.out.println("in constr"); if(args == null) { System.out.println("hello, enter a choice during execution"); } else { char…[] ch = args.toCharArray(); System.out.println("add(digits)="+add(ch)); System.out.println("rev(digits)="+rev(ch)); } } static int add(char[] num) { int t=0; for(int i=0;i=0;i++) { s += String.valueOf(num[i]); } return Integer.parseInt(s); } public static void main(String[] args) { myObj = new SumRevInt(args[0]); }

# Write a C plus plus program to find the sum of digits of a given number?

include int sum_digits(int num, int base=10) { int sum=0; while( num ) { sum+=num%base; num/=base; } return(sum); } int main() { int sum=sum_digits(42); // assert( sum==6); }…

# C plus plus program to find the sum of the digits using constructor?

Constructors cannot return values so the only paractical way of achieving this would be to supply an output parameter to the constructor. But what exectly are you construc…ting and for what reason? You can find the sum of the digits for any value with a simple function. unsigned sum_of_digits(unsigned num) { unsigned sum = 0; do { sum += num % 10; } while (num/=10); return sum; } To achieve the same thing via a constructor you'd need the following: class sum_of_digits { public: sum_of_digits(unsigned num, unsigned& sum) { sum = 0; do { sum += num % 10; } while (num/=10); return sum; } }; This class does absolutely nothing useful. Even though the class is empty (no member data), you must still instantiate an object of the class in order to find the sum. And an empty object consumes memory like any other object. int main() { unsigned sum; sum_of_digits f (42, sum); // Now you've got two objects occupying memory (sum and sum_of_digits). sum = sum_of_digits (42); // With the function call you'd have just one object: the sum itself. }

# What is the program in C language to find average of the digits of a number?

viod main() { int a,b,c; float sum,avg; a=10; b=20; c=30; sum=a+b+c; avg=sum/3; print("\\n Avg : "avg); }

# A program to find sum of digits repeatedly until a single digit is obtained?

include #include main() { int n,s=0,sum=0,i,d; printf("enter the number"); scanf("%d",&n); while(n>0) { d=n%10; s=s+d; n=n/10; } while(s>0) { i=s…%10; sum=sum+i; s=s/10; } printf("%d",sum); getch(); }

Answered

# Write a c program to find the sum of the digits of a number?

include int sumOfDigit(int x){ int ans = 0; while(x>0){ ans += (x%10); x /= 10; } return ans; } int main(void){ printf("%d",sumOfDigit(12)); return 0; …}

Answered

In Technology

# C program to find sum of digits of a number using function?

#include #include void main() { int sumdig(int); int n,sum,d,f,rev=0; clrscr(); printf("enter the number"); scanf("%d",&n); sum=sumdig(n); printf("%d",sum)…; getch(); } int sumdig(int n) { int sum,d,r=0; if(n==0) return(0); else sum=n%10+sumdig(n/10); while(sum!=0) { d=sum%10; r=r+d; sum=sum/10; } return(r); }

Answered

# Write a c program to find the sum of digit of a given number?

for (digsum= 0; n!=0; digsum+=n%10, n/=10);

Answered

In Technology

# Write a program to find the sum of the digits and reverse of the digits using inheritance?

There is a far easier way to implement the required functionality than using inheritance. However, to answer the question, here's one possible solution that makes use of inher…itance: #include #include #include #include // In order to make use of inheritance we need a common base class. // Although the underlying datatype is an integral, we cannot inherit from an integral, // therefore we need to embed the integral in the base class, and provide operators // that allow the class to function as if it were an integral. Only the bare minimum // implementation required to achieve the goal is provided. class integral_t { friend std::ostream& operator

Answered

# How do you find the sum in c language?

include #include void main() { clrscr(); int a,b,sum; printf("Enter two nos."); scanf("%d%d",&a,&b); sum=a+b; printf("Sum is = %d",sum); getch(); }…