Created
January 4, 2018 11:08
-
-
Save rizwansoaib/072d67ba2030941ce05a245d530135c2 to your computer and use it in GitHub Desktop.
For sum of 5 digit
This file contains hidden or 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> | |
void main() | |
{ | |
int x; | |
printf("please enter 5 digit to know sum"); | |
scanf("%d",&x); | |
int a=x%10; | |
int u=x/10; | |
int b=u%10; | |
int v=u/10; | |
int c=v%10; | |
int w=v/10; | |
int d=w%10; | |
int y=w/10; | |
int e=y%10; | |
int ans=a+b+c+d+e; | |
printf("%d",ans); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For sum of 5 digit