sum of digit of given number

/*sum of digit of given number*/
#include<stdio.h>
#include<conio.h>
void main()
{
int number,sum=0,r;
clrscr();
printf("enter the number\n");
scanf("%d",&number);
do
{
r=number%10;
sum=sum+r;
number=number/10;
}
while(number!=0);
printf("sum of digit is=%d\n",sum);
getch();
}



OUTPUT
enter the number
123
sum of digit is=6

Comments

Popular posts from this blog

New Regime Income Tax Calculator 2025-2026

Expense Tracker

Percentage Calculator