Computer Science, asked by rashmim56, 4 months ago

write the program to print the sum of the digits of a given number​

Answers

Answered by skmadhuri114
1

Answer:

#include<stdio.h>

int main()

{

int n,sum=0,m;

printf("Enter a number:");

scanf("%d",&n);

while(n>0)

{

Answered by divyansh721
0

answer=/* C Program to Find Sum of Digits of a Number using For Loop */ include &lt;stdio.h&gt; int main() { int Number, Reminder, Sum; printf("\nPlease Enter any number\n"); scanf("%d", &amp;Number); for (Sum=0; Number &gt; 0;Number=Number/10) { Reminder = Number % 10; Sum=Sum+ Reminder; } printf("\n Sum of the digits of Given Number = %d", Sum); return 0;

Similar questions