Largest of Tenth Digit and Unit Digit

 Coding Problem Keys 

 Largest of Tenth Digit and Unit Digit 

 Problem Statement 

Given an integer N as input, the program must print the largest of the tenth digit and the unit digit in the integer N.

 Boundary Condition(s) 

10 <= N <= 9999999

 Input Format 

The first line contains the value of N.

 Output Format 

The first line contains the largest of the tenth digit and the unit digit in the integer N.

 Example Input/Output 1 

 Input 

5442

 Output 

4

 Explanation 

Tenth digit (4) is greater than unit digit (2).

 Example Input/Output 2 

 Input 

4567

 Output 

7

 Explanation 

Unit digit (7) is greater than tenth digit (6).

 Max Execution Time Limit: 5000 millisecs 

 Solution 

 Programming Language: Python 3 Language 

n=input()
if(n[-1]>n[-2]): print(n[-1])
else: print(n[-2])

# Published By PKJCODERS

 Programming Language: C Language 

#include <stdio.h>
int main(){
    int n,x,y;
    scanf("%d",&n);
    x=n%10;
    n=n/10;
    y=n%10;
    if(x>y)
        printf("%d",x);
    else
        printf("%d",y);
}

// Published By PKJCODERS

 (Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.) 

Comments

Popular Posts

Maximum Sub Square Sum

Search String S2 in S1 Character Matrix

First N Repeated Characters

ASCII Based Encryption

String With Most Vowels

Reverse Column - First and Last