User Profile
Collapse
-
what do you mean the logic is wrong. it is the correct logic. -
This program won't execute
Code:public class Twins { public static void main(String args[]) { int a,b,c; a=1; b=3; for(c=2;c<=97;c++) { if(a%c==0&&b%c==0) System.out.println(a+" and "+b+" are prime twins"); a++; b++; } } }
This was a program to find all the twin prime no.s till 100....Last edited by Frinavale; Sep 28 '10, 05:02 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags and indentation to code posted. -
I can't get this program correct. Someone please help me.
import java.io.*;
public class addsub
{
public static void main(String args[])throws IOException
{
int a,b,s,d;
s=0;
d=0;
InputStreamRead er read=new InputStreamRead er(System.in);
BufferedReader in=new BufferedReader( read);
System.out.prin tln("Enter two numbers");
a=Integer.parse Int(in readLine());
b=Integer.parse Int(in readLine());
s=a+b;
d=a-b;...
No activity results to display
Show More
Leave a comment: