Showing posts with label Stavensev Number. Show all posts
Showing posts with label Stavensev Number. Show all posts

Stavensev Number

 import java.util.*;

class stavensev

{

    public static void main(String[]args)

    {

        Scanner sc=new Scanner (System.in);

        System.out.println("Enter a number::");

        int n=sc.nextInt();

        if((n>700 && n%7==0) || (n<77 && 700%n==0))

        {

            System.out.println("Stavensev Number");

        }

        else

        {

            System.out.println("Not a Stavensev Number");

        }

    }

}

Second largest number in java using ternary operator

 //Largest second number using ternary operator public class Main { public static void main(String[] args) { int a=5,b=6,c=7; int ...