Write C program to find first and last digit of any number

Write C program to find first and last digit of any number


Introduction

Write C program to find first and last digit of any number


techstudy.org

Kindle Paperwhite High Resolution Display Tablet | Rs. 9999

  1. #include <stdio.h>
  2.  
  3. main()
  4. {
  5. int num, last ;
  6. printf("Enter any number : ");
  7. scanf("%d", &num);
  8.  
  9. last = num%10;
  10. printf("The last digit of entered number: %d\n", last);
  11.  
  12. while(num>=10)
  13. {
  14. num = num/10;
  15. }
  16.  
  17. printf("The first digit of entered number: %d\n", num);
  18. }
  19.  

Result

C language

     





Related Topics


Responses




Popular Posts

Facebook

Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer and technology lovers. http://www.techstudy.org/.