Program to enter an integer and print out its successor

Join Our Official AiJobsAdda Telegram Channel
#include <iostream.h>
#include <conio.h>
void value(int);
void main()
{
clrscr();
int x;
cout << “Enter an integer : “;
cin>>x;
cout << “The successor of ” << x << ” is “;
value(x);
getch();
}
void value(int x)
{
x++;
cout << x << “.” << endl;
}

 

This program takes in an integer x as a screen input from the user.
It then determines the successor of the integer and outputs it using the ‘cout’ command.
INPUT :
49

OUTPUT :
The successor of 49 is 50.