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);
}
}

Recommended Answers

All 2 Replies

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??

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.