Advertisement
rony-Rony_05

problem 3

Jun 21st, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.18 KB | None | 0 0
  1. #include<stdio.h>
  2. int  main()
  3. {
  4. int sum=0,n,fd,ld;
  5. scanf("%d",&n);
  6. ld=n%10;
  7. while(n>=10)
  8. {
  9. n=n/10;
  10. }
  11. fd=n;
  12. sum=fd+ld;
  13. printf("first and last digit sum=%d",sum);
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement