Computer Science, asked by subashreeanu15, 1 year ago

Write a 'C' program .Input a and b .Find the smallest number greater than b by inter changing the digits of a and if not possible return -1

Answers

Answered by Anonymous
0

Answer:

#include<stdio.h>

#include<conio.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