Computer Science, asked by SANRIDDHA, 5 hours ago

import java. util. Scanner;
public class Main {
public static void main(String[] args) {
int i, j, e, f;
Scanner scan=new Scanner ( System.in ) ;
System. out. println("Enter first number:");
int a = scan. nextInt();
System. out. println("Enter second number");
int b = scan. nextInt();
for (i=2;i<=a;i++);
c=a%i;
for (j=2;j<=b; j++);
d=b%i;
if (c=0 && d=0)
{
System.out.println(" not prime numbers");
}
else
if (c=0 && d!=0 || c!=0 && d=0)
{
System. out. println("one number is not a prime number");
}
}
int e = a-b;
int f = b-a;
else {
if (e!=2 || f!=2)
{
System. out. println("both are prime numbers but not twin prime");
}
else
System. out. println("Twin prime");
}
}
I am getting 'illegal start of expression' error in this
Please tell ehat will be the correct program for twin primes in java

Answers

Answered by Anonymous
1

Explanation:

u didnt use loop brackets for "for" "{"

"}"

Similar questions