User Profile

Collapse

Profile Sidebar

Collapse
Sachu1996
Sachu1996
Last Activity: Oct 9 '10, 12:03 PM
Joined: Jun 27 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Sachu1996
    replied to This program won't execute
    in Java
    what do you mean the logic is wrong. it is the correct logic.
    See more | Go to post

    Leave a comment:


  • Sachu1996
    started a topic This program won't execute
    in Java

    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....
    See more | Go to post
    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;...
    See more | Go to post
No activity results to display
Show More
Working...