Sample – Program to enter an integer and print out its successor.

by Nideesh C on February 8, 2011 · 0 comments

in C++




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

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. Sample – Program to enter an integer and output the cube of that integer.
  2. Sample – Program to enter a string and find its length.
  3. Sample – understanding life time and scope
  4. Sample – understanding scope
  5. Sample program (multiplication using addition)

Leave a Comment

Previous post:

Next post: