Advertisement
Sierra_ONE

Find The Tail

Oct 8th, 2023
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | Source Code | 0 0
  1. /*
  2. 6. Find the Tail
  3. Letโ€™s play a game! Iโ€™m going to give you a 3-digit number and youโ€™re going to tell me which is its tail. The tail is the last digit of the number. Ready? Go!
  4.  
  5. Inputs
  6. 1. A 3-digit number
  7. */
  8.  
  9. #include <stdio.h>
  10.  
  11. int main(){
  12.    
  13.     int num,s1;
  14.    
  15.     printf("Enter the number: ");
  16.     scanf("%d",&num); //decimal so based 10
  17.                         //if binary = base 2
  18.     s1 = num % 10;
  19.    
  20.     printf("%d",s1);
  21.    
  22.  
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement