Computer Science, asked by sumanshubham14, 1 year ago

write a c program.input a and b.find the smallest number greater than b by interchanging the digit of a and if not possible return -1

Answers

Answered by Anonymous
0

Answer:

#c program

#include<stdio.h>

main()

{

int a, b,rev=0,d,return;

do

{

printf("Enter two numbers a and b \n");

scanf("%d %d", &a, &b)

}while(b<a);

while(a!=0)

{

d=a%10;

rev=(rev*10)+d;

a=a/10;

if(rev>b)

{

printf("%d is greater than %d \n", rev,b);

}

else if (rev==b)

{

print{"Both are equal \n");

}

else

{

return= -1;

printf("%d",return)

}

}

Similar questions