Program to find predecessor & successor of a number.
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, c;
clrscr();
printf ("Enter a number to find it's predecessor & successor: \n");
scanf (%d, &a);
b = a + 1;
printf ("The successor of %d is: %d\n", a, b);
c = a - 1;
printf ("The predecessor of %d is: %d\n", a, c);
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, c;
clrscr();
printf ("Enter a number to find it's predecessor & successor: \n");
scanf (%d, &a);
b = a + 1;
printf ("The successor of %d is: %d\n", a, b);
c = a - 1;
printf ("The predecessor of %d is: %d\n", a, c);
getch();
}