Computer Science, asked by bindur8483, 1 year ago

write a c program to calculate sum of digits of a 5 digit numbers

Answers

Answered by souravsarkar045
0

#include<stdio.h>

#include<conio.h>

void main()

{

int m,r,n,sum=0;

clrscr();

printf("Enter any number : ");

scanf("%d", &m);

while(n>0)

{

r=m%10;

n=m/10;

m=n;

sum=sum+r;

}

printf("sum=%d", sum);

getch();

}

Thank you.

Similar questions