Skip to content

Instantly share code, notes, and snippets.

@jaideepjagyasi
Created September 18, 2017 17:12
Show Gist options
  • Save jaideepjagyasi/8b305f409df355a297221c58f6fd1738 to your computer and use it in GitHub Desktop.
Save jaideepjagyasi/8b305f409df355a297221c58f6fd1738 to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main(){
int n;
int temp=0;
int res=0;
printf("Enter number");
scanf("%d",&n);
temp=n%10;
n=n/10;
res+=temp;
while(n>0){
if(n/10==0){
res+=n%10;
}
n=n/10;
}
printf("%d",res);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment