Write a program to check whether the last digit of a number( entered by user ) is divisible by 3 or not.
Answers
Answer:
import java.util.*;
class number{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println("Enter any number");
int a=sc.nextInt();
if(a/3==0){
System.out.println("The given number is divisible by 3");
}
else{
System.out.println("The given number is not divisible by 3");
}
}
}
hope it helps.
pls mark me as the brainliest
Answer:
Explanation:
Phyton:
Python is a popular computer programming language used to create software and websites, automate processes, and analyze data. Since Python is a general-purpose language, it may be used to develop a wide range of programs and isn't tailored for any particular issues.
Guido van Rossum created Python, an interpreted, object-oriented, high-level programming language with dynamic semantics. It was first made available in 1991. The name "Python" is a tribute to the British comedy group Monty Python and is meant to be both simple and entertaining.
Python is today among the most well-known and frequently used programming languages in the world, despite having its origins as a side project bearing the moniker Monty Python. Python is used for data analytics, machine learning, and even design in addition to web and software development.
Write a program to check whether the last digit of a number( entered by user ) is divisible by 3 or not.
Step 1:
This software determines if the user-entered number's last digit is divisible by three or not.
In the following step, locate the program.
Step 2:
Source code:
number=int(input("Enter the number : "))
last_digit = number%
if(last_digit%==):
print("Last digit of given number is {} and is divisible by ".format(last_digit))
else:
print("Last digit of given number is {} and is not divisible by ''.format(last_digit))
Step 3:
Enter the number :
Last digit of the given number is and is divisible by
Enter the number :
Last digit of the given number is and is not divisible by
#SPJ2