Canna

Sunday, 23 September 2018

IO 14

Problem Description

Ram was a popular maths teacher, he gave a 4 digit number to his students as a assignment .He has to identify ones portion of given number. Please help his students to identify and display the output:

Input and Output Format:

Input can be an integer
Explanation :

Let us say ram given number is 1234 and his student need to identify ones portion is 4

  • Test Case 1

    Input (stdin)
    72
    
    
    Expected Output
    The Digit at ones place of 72 is=2
  • Test Case 2

    Input (stdin)
    456
    
    
    Expected Output
    The Digit at ones place of 456 is=6
  • Program
  • #include <stdio.h>
    int main()
    {
    int n, c;
      scanf("%d", & n) ;
      c=n%10;
     
      printf("The Digit at ones place of %d is=%d", n, c);
     return 0;
    }

No comments:

Post a Comment

Note: only a member of this blog may post a comment.