write a program to input a number and check it is 0 or non 0
Answers
Answered by
0
int num;
cout<<“Enter Number: “;
cin>>num;
if(0==num)
{
cout<}
else
{
cout<}
cout<<“Enter Number: “;
cin>>num;
if(0==num)
{
cout<}
else
{
cout<}
Answered by
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
Math,
6 months ago
English,
6 months ago
History,
1 year ago
English,
1 year ago
Social Sciences,
1 year ago