Computer Science, asked by 9415ssinghgmailcom, 10 months ago

write a program in Java to check whether the last digit is 5 or not in a positive integer number example 125​

Answers

Answered by sanjeevsitapur2
2

Answer:

It's So Easy to Make Let Us Have a Illustration here..:--

class program{ // You Program Class Name to be Written Accordingly

public static void main(String []args){

int n = 125; //You Can Change it Accordingly or You Can Use Scanner Class as well..

int a = n % 10; // This is How we Get the Last Digit

if(a==5){

System.out.println("Last Digit is 5");

}else{

System.out.println("Last Digit is not 5");

}

}

}

------------------------------------------------------------------------

This is How We Illustrate the Code.

WRITTEN IN JAVA

HOPE YOU LIKE IT!!

MARK AS BRAINLIST ANSWER

Similar questions