Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * @author Ravinesh
- *
- */
- public class que3_hcf {
- /**
- * @param args
- *
- */
- public static int elucid(int x, int y) {
- while (y != 0) {
- int r = x % y;
- x = y;
- y = r;
- }
- return x;
- }
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int m,n;
- Scanner in = new Scanner(System.in);
- System.out.println("Computing the HCF \nEnter the Value of first no : ");
- m = in.nextInt();
- System.out.println("Enter the Value of second no : ");
- n = in.nextInt();
- System.out.println("the HCF betwwen " + m + " & "+ n + " is : " + elucid(m, n));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment