C++ program to print successor of a Number

Write a C++ program to print successor of a Number.

PROGRAM:

#include <iostream>
using namespace std;

void value(int);

int main()
{

    int x;
    cout << "Enter an integer : ";
    cin>>x;
    cout << "The successor of " << x << " is ";
    value(x);
    return 0;
}
void value(int x)
{
x++;
cout << x << "." << endl;
}

 

OUTPUT:

Enter an integer : 25
The successor of 25 is 26.

--------------------------------

 

Leave a Comment