Niloy007

Pranto's Problem 1

Mar 23rd, 2021
497
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int n;
  5.     printf("Enter the number:\n");
  6.     scanf("%d", &n);
  7.  
  8.     int last = n % 10;
  9.     int first = 0;
  10.     while (n > 0) {
  11.         first = n % 10;
  12.         n /= 10;
  13.     }
  14.     printf("First and last numbers are: %d %d\n", first, last);
  15. }
RAW Paste Data