Entri Populer

Selasa, 25 Januari 2011

Program to enter an integer and print out its successor.


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

Tidak ada komentar:

Posting Komentar