C : Program to calculate the sum digits of a number.
#include<conio.h>
main()
{
int x,n;
printf("Enter a
number :");
scanf("%d",&n);
x=sum_digit(n);
printf("%d",x);
}
int sum_digit(int n)
{
int s=0;
while(n>0)
{
s=s + n%10;
n=n/10;
}
return s;
}
Output:
Following quiz provides Multiple Choice Questions (MCQs) related to C Programming Framework. You will have to read all the given answ...
-
Character I/O: Visual Basic provides some excellent ways for input and output operations. Input can be taken using TextBox, InputBox, ...
-
Design a form contains a sorted list alphabetically such that the user can add the item from text to the list after click on command button...
-
Scientific Calculator Created Using Visual Basic This is a calculator that resembles a typical scientific calculator , albeit a simpler ...