Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n, first_dig,last_dig,sum=0;
- printf("Enter any number: ");
- scanf("%d", &n);
- first_dig = n;
- while(first_dig >= 10)
- {
- first_dig = first_dig / 10;
- last_dig =n%10;
- sum=first_dig+last_dig;
- }
- printf("First & Last digit summation = %d",sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement