Created
September 22, 2013 21:28
-
-
Save MaratB/6663996 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <conio.h> | |
int Summa(int N) | |
{ | |
int d,sum=0; | |
while(N!=0) | |
{ | |
d=N%10; | |
sum=sum+d; | |
N=N/10; | |
} | |
return sum; | |
} | |
main() | |
{ | |
int N,S; | |
printf("Enter integer to find the sum of its digits: \n"); | |
scanf("%d", N); | |
S=Summa(N); | |
printf("Sum of digints is %d", S); | |
getch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment