0

what wrong with this?

import java.util.Scanner;
public class mid2 {
   public static void main(String[] args) {
     int a;
   int m;
   boolean jv=true;
      Scanner sc=new Scanner (System.in);
     System.out.println("Programmed by: Jesus Vinson J. Dominguez:");
     System.out.println("Pls type number:");
    a=sc.nextInt();
     System.out.println("Pls type another number:");
    m=sc.nextInt();
 
int gcf=1;
int k=2;
while (k=<a && k<=m){
    if (a % k==0 && m%==0)
gcf=k;
    k++;
}
System.out.println("Greates Common factor:"+gcf);
}
}

Edited by __avd: Added [code] tags.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by JDCyrus
0

Next time please wrap your codes within the CODE tag.

I think you should be the one telling us what's wrong with your code.

What are the errors that you are having?? What are the inputs and outputs?? What do you expect your program will do??

Edited by happygeek: fixed formatting

0

This seems to contain syntax errors. Specifically, you're using two operators that aren't valid operators: =< (the operator for "less than or equal to" is <=), and %== (I have no idea what this is supposed to be).

In future, kindly wrap code in CODE-tags and indent it before posting.

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.