Computer Science, asked by pinu25, 1 year ago

write a program to input a number and check it is 0 or non 0

Answers

Answered by meshwapatel556p74x41
0
int num;
cout<<“Enter Number: “;
cin>>num;
if(0==num)
{
cout<}
else
{
cout<}
Answered by BrainlyPromoter
0

import java.util.*;

class Pract

{

   public static void Practice()

   {

       Scanner Promoter = new Scanner(System.in);

       System.out.print("Enter the number to be checked.");

       double d = Promoter.nextDouble();

       int c = 0;

       for( int k = 1 ; k <= d ; k++ )

       {

           if( d % k == 0)

               c++;

       }

       if( c == 2 )

           System.out.println(d+" is a prime number");

       else

           System.out.println(d+" is not a prime number");

   }

}

Output:

Enter the number to be checked.37

37.0 is a prime number

Similar questions