Computer Science, asked by sourabhkushwahcse21, 7 months ago

Compute nearest larger number by interchanging digits updated.
Given 2 numbers a and b find the smallest number greater than b by interchanging the digits of a and if not possible print -1.

Answers

Answered by adityasrivastava6578
3

Answer:

/* C++ Program - Find HCF and LCM of Two Numbers */

 

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a, b, x, y, t, hcf, lcm;

cout<<"Enter two number : ";

cin>>x>>y;

a=x;

b=y;

while(b!=0)

{

 t=b;

 b=a%b;

 a=t;

}

hcf=a;

lcm=(x*y)/hcf;

cout<<"HCF = "<<hcf<<"\n"

cout<<"LCM = "<<lcm<<"\n";

getch();

}

Output

Enter two number:20

8

HCF=4

LCM=40

Explanation:

Similar questions